objc/7035: Wrong code in byte-swapping routine generated
marco@technoboredom.net
marco@technoboredom.net
Sat Jun 15 04:16:00 GMT 2002
>Number: 7035
>Category: objc
>Synopsis: Wrong code in byte-swapping routine generated
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri Jun 14 16:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: marco@technoboredom.net
>Release: unknown-1.0
>Organization:
>Environment:
marco@gontscharow:~ > uname -a
Linux gontscharow 2.4.4-4GB #1 Sat Jun 23 05:26:59 GMT 2001 i686 unknown
marco@gontscharow:~ > gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc-3.1/configure --prefix=/usr --enable-shared --enable-threads=pthreads --enable-languages=ada,c,c++,f77,java,objc : (reconfigured) ../gcc-3.1/configure --prefix=/usr --enable-shared --enable-threads=pthreads --enable-languages=c,c++,f77,java,objc : (reconfigured) ../gcc-3.1/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-languages=c,c++,f77,java,objc
Thread model: posix
gcc version 3.1
>Description:
The Objective-C compiler generates wrong code in GNUstep's byteswapping-routines with the -O2 switch.
This is most likely a duplicate to #6834, however I have a shorter testcase (23 lines) here.
>How-To-Repeat:
marco@gontscharow:~/tmp > gcc -O2 bla.m -o bla
marco@gontscharow:~/tmp > ./bla
GSU(0)=191
marco@gontscharow:~/tmp > gcc bla.m -o bla
marco@gontscharow:~/tmp > ./bla
GSU(0)=0
--
The result should be 0 (=byteswap of 0). Compiling this code as a C-programm also returns the correct value, no matter which optimization was selected.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bla.m"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bla.m"
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHVuc2lnbmVkIGludCBnc3UzMjsgCnR5cGVkZWYg
dW5zaWduZWQgY2hhciBnc3U4OyAKc3RhdGljIGlubGluZSBnc3UzMgpHU1N3YXBJMzIoZ3N1MzIg
aW4pCnsKICB1bmlvbiBzd2FwIHsKICAgIGdzdTMyCW51bTsKICAgIGdzdTgJYnl0WzRdOwogIH0g
ZHN0OwogIHVuaW9uIHN3YXAJKnNyYyA9ICh1bmlvbiBzd2FwKikmaW47CiAgZHN0LmJ5dFswXSA9
IHNyYy0+Ynl0WzNdOwogIGRzdC5ieXRbMV0gPSBzcmMtPmJ5dFsyXTsKICBkc3QuYnl0WzJdID0g
c3JjLT5ieXRbMV07CiAgZHN0LmJ5dFszXSA9IHNyYy0+Ynl0WzBdOwogIHJldHVybiBkc3QubnVt
Owp9CgppbnQgbWFpbigpIAp7CglwcmludGYoIkdTVSgwKT0lZFxuIixHU1N3YXBJMzIoMCkpOwp9
Cg==
More information about the Gcc-bugs
mailing list