On Fri, Oct 19, 2001 at 01:03:05AM +0200, Klaus Borchers wrote:
> I think I came across a possible bug in gcc when using -O2 optimisation
> on using the following program .
>
> When executed, the function returns "99", i.e. at the time the switch(sw) is
> calculated, the wrong case is taken.
>
> I have tried three different compilers, and all showed the problem :
>
> > gcc version 2.95.2 20000220 (Debian GNU/Linux) (native onSA1110)
>
> > gcc version 2.95.3 20010125 (prerelease) (native on
>skiffclusters2.handhelds.org)
> > gcc version egcs-2.91.60 19990113/philb (egcs-1.1.1 release) (cross-compiler
>hosted on x86)
I have just tested:
gcc 2.7.2.2 on ARM:
gcc version 2.7.2.2
gcc 2.91.66 on ARM:
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
gcc 2.95.1 on ARM (redhat kgcc):
gcc version 2.95.1 19990816 (release)
gcc 2.95.2 on ARM (gcc on netwinder):
gcc version 2.95.2 20000516 (release) [Rebel.com]
cross gcc 2.95.3 on x86 (erikm's compiler on the ftp site):
gcc version 2.95.3 20010315 (release)
gcc 2.96 built from redhat on ARM:
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-80)
And what we have is (this includes your compilers):
version host result
----------------------------------------------------------------------
2.7.2.2 arm ok
egcs-2.91.60 19990113/philb (egcs-1.1.1 release) x86 bad
egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) arm bad
egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) x86 bad
2.95.1 19990816 (release) arm ok
2.95.2 20000220 (Debian GNU/Linux) arm bad
2.95.2 20000516 (release) [Rebel.com] arm ok
2.95.3 20010125 (prerelease) arm bad
2.95.3 20010315 (release) x86 bad
2.96 20000731 (Red Hat Linux 7.1 2.96-80) arm ok
Hope this provides some clues.
_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.