This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: grokfield miscompiled with -O9
On Sat, Jan 08, 2000 at 07:46:09PM +0100, Martin v. Loewis wrote:
> > No. Someone should sit down and figure out what the actual problem
> > is.
>
> Ok. Here is as far as I got. grokfield gets miscompiled under certain
> circumstances, passing incorrect (out-of-range) decl_context values to
> grokdeclarator. I've trimmed-down the source of c-decl.c to a minimum
> size. I also attach the corresponding assembler code, obtained with
> -O9, on i586-pc-linux-gnu, with 2.96 19991222.
...
> The optimization being done here is that FIELD+1 == BITFIELD, so if
> edi (==width) is not null, 3+1 should be pushed, otherwise
> 3. Unfortunately, the high part of eax is not cleared, so it pushes
> garbage. Under slight modification of the source, it produces the
> fragment
>
> pushl $0
> andl $255, %eax
> addl $3, %eax
I wonder if this isn't the same bug as execute/991112-1.c. That one has
to do with -O3 and not clearing an entire register, too.
zw