gcc 3.0.1 generates bad code
Kenneth Gole
kengole@us.ibm.com
Fri Oct 19 08:10:00 GMT 2001
Hello,
I'm using gcc 3.0.1 on i686 Linux (Redhat 6.2). Compile the attached
program, and it will segfault on line 20. This code compiles and works fine
on AIX, Solaris, HP, and earlier versions of gcc. We suspect that the
compier is making assumptions about "p->i" before a function call that sets
"p" as a side-effect. We can work around this by creating a temporary
integer variable to receive the return value from createp( ) and then
assign the temp to p->i, but we're concerned that this segfault might be
indicative of a deeper compiler problem. Let me know if you need any
further information from me. Thanks!
gcc -v output:
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/specs
Configured with: ./configure --enable-shared --enable-languages=c++,java
--enable-threads=posix
Thread model: posix
gcc version 3.0.1
(See attached file: bad.c)
Ken Gole T/L: 855-2344 Phone: (607)755-2344
email: KenGole@us.ibm.com Internal: KenGole@ibmusm10
Lotus Notes ID: Kenneth Gole/Endicott/IBM @ IBMUS
bad.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad.c
Type: text/x-c
Size: 448 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20011019/1dcd5476/attachment.bin>
More information about the Gcc-bugs
mailing list