EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  <19981999  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 1994  1995  1996  1997  <19981999  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: beta12 & GPIB & Compiler Bug
From: Marty Kraimer <[email protected]>
To: [email protected]
Date: Fri, 25 Sep 1998 10:09:23 -0500
GPIB device support which is implemented by starting the John Winan's
template
has the statements:

static struct devGpibParmBlock devSupParams;

...

static struct devGpibParmBlock devSupParams = {
...
};

Note that this is legal ISO C but is not legal C++

Josh Stein (APS/ASD) could not make GPIB work with beta12.
We discovered that the above does not work on beta12 but does work on
beta11.

Below is  proof that it is a compiler bug.

Question: Has anyone else seen this bug?
If so do you know a solution?
Will a later version of GNU C fix the problem?

Comment:

If devSupParams is made external it works.

Proof of compiler bug.


The following test was run.

#include <stdio.h>
struct test {
    int x;
    int y;
};
static struct test mystruct;
static struct test mystruct = {1,2};

int myTest()
{
printf("mystruct %d %d\n",mystruct.x,mystruct.y);
return(0);
}


On VxWorks version 5.3.1 the result is:

mystruct 0 0


On VxWorks version 5.2 the result is

mystruct 1 2


On VxWorks version 5.3.1 the compiler output is:

#NO_APP
gcc2_compiled.:
___gnu_compiled_c:
        .long 1
        .long 2
.text
LC0:
        .ascii "mystruct %d %d\12\0"
        .even
.globl _myTest
_myTest:
        pea a6@
        movel sp,a6
        lea _statics+4,a0
        movel a0@,sp@-
        movel a0@(-4),sp@-
        pea LC0
        jbsr _printf
        clrl d0
        unlk a6
        rts
.data
        .even
_statics:
        .skip 8


VxWorks version 5.2 generated.


#NO_APP
gcc2_compiled.:
.data
        .even
_mystruct:
        .long 1
        .long 2
.text
LC0:
        .ascii "mystruct %d %d\12\0"
        .even
.globl _myTest
_myTest:
        link a6,#0
        movel _mystruct+4,sp@-
        movel _mystruct,sp@-
        pea LC0
        jbsr _printf
        clrl d0
        unlk a6
        rts


Marty Kraimer

Replies:
Re: beta12 & GPIB & Compiler Bug Benjamin Franksen

Navigate by Date:
Prev: Re: MBBI & mask Marty Kraimer
Next: RE: Limits problems in MEDM and the Histogram Record Ken Evans
Index: 1994  1995  1996  1997  <19981999  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: Re: MBBI & mask Marty Kraimer
Next: Re: beta12 & GPIB & Compiler Bug Benjamin Franksen
Index: 1994  1995  1996  1997  <19981999  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 ·