EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: calc and calcout records in EPICS 3.14.6
From: Dirk Zimoch <[email protected]>
To: Geoff Savage <[email protected]>
Cc: EPICS Tech-Talk <[email protected]>
Date: Tue, 16 Nov 2004 09:30:33 +0100
Hi,

some time ago, I noticed a bug in the ccppc for Tornado 2 running on Linux.

gcc version gcc-2.96 (2.96+) 19990621 AltiVec

I got the sources from SNS.

When used with -O, the compiler produces buggy floating point code. I noticed that forst in the calcout record, because instead of =, it calculates <= or so.

I reported the problem to Dave Thompson, but got no fix so far.

Hello Dave,

I have dowloaded your Tornado 2.2 cross compiler for Linux and built EPICS3.13 with it.

Unfortunately, I found a serious bug: The calc record didn't work any more!

The simple CALC "A=B" behaves like "A<=B" what I found very strange. I found that I only had the problem when using the -O compiler flag. Without optimization, everything is fine.

I guess that the bug also leads to a lot of other errors.


I tracked the problem down to:


double a,b,c;
a=1;
b=2;
c=(a==b);

results in 1.0000 !

But

double a,b,c;
int i;
a=1;
b=2;
i=(a==b);
c=i;

result to 0.0000 as expected.

The problem is independent of EPICS. I just compiled the attached C-file with 'ccppc -c -O comptest.c' and loaded the object code on a MVME5100 IOC with only vxWorks running.

The generated assembler code looks different from the code generated on Solaris.

Have you ever seen this? What's going wrong? Can you fix it?


Best regards Dirk


My solution is not to use the -O2 optimize flag.


Dirk


Geoff Savage wrote:
Hi,

We noticed some changed behaviour in calc and calcout records from v3.13.4 to v3.14.6 and were unable to identify the cause. Take a simple calc record, maybe too simple:
record(calc,"CTL_TEST_66/CALC") {
field(CALC, "1=0")
field(SCAN, "1 second")
}
In v3.13.4 VAL is the expected value of zero. In v3.14.6 VAL is one. The same applies for the calcout record.


What are we missing?

Geoff


-- Dr. Dirk Zimoch Swiss Light Source Paul Scherrer Institut Computing and Controls phone +41 56 310 5182 fax +41 56 310 4413

Replies:
Re: calc and calcout records in EPICS 3.14.6 Andrew Johnson
References:
calc and calcout records in EPICS 3.14.6 Geoff Savage

Navigate by Date:
Prev: RE: calc and calcout records in EPICS 3.14.6 Mark Rivers
Next: RE: calc and calcout records in EPICS 3.14.6 Singleton, SJ (Steve)
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: calc and calcout records in EPICS 3.14.6 Geoff Savage
Next: Re: calc and calcout records in EPICS 3.14.6 Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·