Bug#288721: gcc-3.3: gcc produces wrong code with -O1 or -O2 for very simple C program (included)
Manuel Bilderbeek wrote:
> Package: gcc-3.3
> Version: 1:3.3.5-5
> Severity: important
>
>
> When compiling the included program with the mentioned versions of gcc,
> wrong code is generated when using -O1 or -O2. See the comments in the
> program, which I saved as test.c:
>
> ---------------------- CUT HERE -----------------------
>
> /* This small program shows a bug in the optimizer of gcc.
> * It occurs at least in these versions:
> * - gcc (GCC) 3.3.4 (Debian 1:3.3.4-13)
> * - gcc (GCC) 3.3.5 (Debian 1:3.3.5-5)
> * It does not occur when the body of f is put directly in main.
> * It does not occur when the "if" is split into two "if"s.
> * It does not occur when -O0 or -O3 (or higher) is used.
> * It only occurs if -O1 or -O2 are used.
I couldn't reproduce it on mips with gcc 3.3.5-5, so it seems also to
be arch-specific. On i386 I see the problem as well.
Thiemo
Reply to: