EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  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  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: R3.14.10 bug in subRecord.c
From: Andrew Johnson <[email protected]>
To: "EPICS tech-talk" <[email protected]>
Date: Wed, 14 Jan 2009 17:39:53 -0600
Mea culpa.

During a major reorganization and cleanup of the subRecord.c code prior to the 
release of Base 3.14.10, I managed to introduce a rather major bug into it.

It surprised me slightly that this hasn't been reported before now.  It looks 
like the bug will only appear if you make more than one of the INP fields 
into a PV link, and some compilers may generate the correct code anyway (it 
triggers undefined behavior).

Apply the attached patch file to your R3.14.10 base/src/rec/subRecord.c file 
to fix.  For anyone interested, dbGetLink() is a macro that instantiates its 
first argument twice.

Sorry,

- Andrew
-- 
The best FOSS code is written to be read by other humans -- Harold Welte
Index: subRecord.c
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/rec/subRecord.c,v
retrieving revision 1.25.2.6
diff -d -u -b -B -p -r1.25.2.6 subRecord.c
--- subRecord.c	8 Aug 2008 19:19:55 -0000	1.25.2.6
+++ subRecord.c	14 Jan 2009 23:12:43 -0000
@@ -386,8 +386,8 @@ static long fetch_values(subRecord *prec
     double *pvalue = &prec->a;
     int i;
 
-    for (i = 0; i < INP_ARG_MAX; i++) {
-        if (dbGetLink(plink++, DBR_DOUBLE, pvalue++, 0, 0))
+    for (i = 0; i < INP_ARG_MAX; i++, plink++, pvalue++) {
+        if (dbGetLink(plink, DBR_DOUBLE, pvalue, 0, 0))
             return -1;
     }
     return 0;

Navigate by Date:
Prev: Re: stop all motors Kate Feng
Next: sequencer cross talk! Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Looking for Wilkinson-type ADC Liyu, Andrei V
Next: sequencer cross talk! Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·