This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bootstrap failure, x86: stage1 miscompiles gengenrtl
- To: Zack Weinberg <zack at wolery dot cumb dot org>
- Subject: Re: bootstrap failure, x86: stage1 miscompiles gengenrtl
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Fri, 31 Mar 2000 11:04:12 +1000 (EST)
- cc: gcc-bugs at gcc dot gnu dot org
On Thu, 30 Mar 2000, Zack Weinberg wrote:
> stage1/xgcc -Bstage1/ -B/work/inst/i686-pc-linux-gnu/bin/ -c -DIN_GCC
> -W -Wall -Wtraditional -O2 -g -W -Wall -Wtraditional -DHAVE_CONFIG_H
> -I. -I/work/src/hashtab.gcc/gcc -I/work/src/hashtab.gcc/gcc/config
> -I/work/src/hashtab.gcc/gcc/../include
> /work/src/hashtab.gcc/gcc/gengenrtl.c
> stage1/xgcc -Bstage1/ -B/work/inst/i686-pc-linux-gnu/bin/ -DIN_GCC -W
> -Wall -Wtraditional -O2 -g -W -Wall -Wtraditional -DHAVE_CONFIG_H
> -o gengenrtl gengenrtl.o obstack.o
> ./gengenrtl -h >tmp-genrtl.h
> Segmentation fault
>
> $ catchsegv ./gengenrtl -h
>
> ...
> extern rtx gen_rtx_fmt_uuuu PARAMS ((RTX_CODE, enum machine_mode mode,
> rtx arg117, rtx arg117, rtx arg117,
> rtx arg117));
>
> *** Segmentation fault
> Backtrace:
> libc.so.6(_IO_vfprintf+0x17df)
> libc.so.6(printf+0x2a)
> gengenrtl.c:264(genmacro)
> gengenrtl.c:344(genheader)
> gengenrtl.c:405(main)
>
> Line 264 of gengenrtl.c is
>
> printf ("#define gen_rtx_%s%s(MODE",
> special_rtx (idx) ? "raw_" : "", defs[idx].enumname);
>
> corresponding to this hunk of assembly output:
>
>
> movl 8(%ebp), %edi
> .stabn 68,0,261,.LM74-genmacro
> .LM74:
> leal (%edi,%edi,2), %eax
> leal 0(,%eax,4), %ebx
> movl defs(%ebx), %eax
> pushl %eax
> subl $12, %esp
The above two instructions seem to be in the wrong order. That's likely
your segv problem.
> pushl %edi
> call special_rtx
> testl %eax, %eax
> movl $.LC125, %eax
> je .L362
> movl $.LC340, %eax
> .L362:
> pushl %eax
> .stabn 68,0,264,.LM75-genmacro
> .LM75:
> xorl %esi, %esi
> .stabn 68,0,261,.LM76-genmacro
> .LM76:
> pushl $.LC341
> call printf
> ...
> .LC125:
> .string ""
> .LC340:
> .string "raw_"
> .LC341:
> .string "#define gen_rtx_%s%s(MODE"
>
> Given the recent sizing changes, I am inclined to suspect this chunk
> of code:
>
> movl 8(%ebp), %edi
> leal (%edi,%edi,2), %eax
> leal 0(,%eax,4), %ebx
> movl defs(%ebx), %eax
> pushl %eax
>
> That's supposed to calculate defs[idx].enumname. The analogous code
> generated by gcc 2.95 reads
>
> movl 8(%ebp), %edi
> addl %edi, %edi
> movl 8(%ebp), %edx
> leal (%edx,%edi), %eax
> leal 0(,%eax,4), %esi
> movl $defs, %ebx
> pushl (%esi, %ebx)
>
> I'm not exactly an x86 assembly expert, but it appears to me that the
> code generated by 2.95 is multiplying idx by 3 before the
> leal 0(,%eax,4) instruction, while the current tree is multiplying it
> by 4. sizeof(*defs) is 12; both versions agree on that if explicitly
> asked.
Nup. "leal (%edi,%edi,2), %eax" does eax = edi + edi * 2
--
Linuxcare. Support for the Revolution.