EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Bug in CA client VAX architecture conversion routines
From: [email protected] (Jeff Hill)
Date: Tue, 5 Jul 94 11:00:00 MDT
Hello,

This message is directed to persons running EPICS on the VAX. 


Chris Mayer ([email protected]) has discovered a bug in the 
channel access client VAX architecture dependent data conversion 
routines. The problem will show up if you are using one of types
dbr_short, dbr_enum, or dbr_long.


This is perhaps cryptic and confusing but ok:

    for(i=0; i<num; i++){
	*d++ = *s++;
    }

However this wasnt:

    for(i=0; i<num; i++){
        *d++ = ntohs( *s++ );
    }

The problem is that ntohs() is a macro and there is an 
unexpected side effect where the ++ operator is executed twice
so we get one byte correctly and the other byte is garbage:

#  define ntohs(SHORT)\
   ((unsigned short)(((short)(SHORT))<<8 | ((unsigned short)(SHORT))>>8 ))

I will apply this fix to 3 instances in convert.c for EPICS 3.12.

Jeff

______________________________________________________________________
Jeffrey O. Hill			Internet	[email protected]
LANL MS H820			Voice		505 665 1831
Los Alamos, NM USA 87545	FAX		505 665 5107


Navigate by Date:
Prev: Solaris and EPICS mcgehee
Next: Need to use a board in various configurations. Bill Brown
Index: <19941995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Solaris and EPICS mcgehee
Next: Need to use a board in various configurations. Bill Brown
Index: <19941995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  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 ·