conversion operator problem in x86?

Shigeya Suzuki shigeya@foretune.co.jp
Wed Sep 30 02:39:00 GMT 1998


>>>>> "oliva" == Alexandre Oliva <oliva@dcc.unicamp.br> writes:

oliva> I've just tested it on RedHat Linux 5.0/x86, and it compiles fine with 
oliva> the latest snapshot of egcs.

oliva> I think you're out of luck :-(

I found that cc1plus is crashing in convert_regs function in
reg-stack.c.  I created source and checked it, and found it seems to
be something wrong in different way..

But snapshot taken on 9/21, and there are no such problem, and I got
above report -- why this is happenning on my machine??


following line, in conver_regs function,

      block_stack_in[block].reg[++block_stack_in[block].top] = reg;

cause cc1plus to generate bad code (at least, in my configuration)


.stabn 68,0,3065,.LM1126-convert_regs
#  3065                block_stack_in[block].reg[++block_stack_in[block].top] = reg;
.LM1126:
					; %edi = block_stack_in here.
	movl -44(%ebp),%edx		; block
	movl (%edi,%edx),%edx		; fetch from block_stack_in[block].top
					; %edx = block_stack_in[block].top
	movl %edx,-60(%ebp)		; save current value?? (why??)
	incl %edx			; ++
	movl -44(%ebp),%ecx		; block
	movl %edx,(%edi,%ecx)		; store to block_stack_in[block].top
	movl %ecx,%edi			; %edi = block. why?
	movl %edi,%edx			; %edx = block, now ecx=edx=edi=block
	leal 8(%edx,%edi),%eax		; ??? at least %edx,%edi is not address
	movl -60(%ebp),%ecx		; previous block_stack_in value
	movb %bl,1(%eax,%ecx)		; here, ecx nor eax are not address
	movl block_stack_in,%edi	;
	movl %edi,-52(%ebp)		;
.stabn 68,0,3063,.LM1127-convert_regs


I believe %edi is broken in above 'leal' line. which cause crash.
(Actually, on my machine) as follows;


(gdb) run z.ii -quiet -dumpbase z.cc -version -o z.s
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr0/home/shigeya/work/egcs/snap12/gcc/stage2/cc1plus z.ii -quiet -dumpbase z.cc -version -o z.s
GNU C++ version egcs-2.92.11 19980926 (gcc2 ss-980609 experimental) (i386-pc-bsdi4.0) compiled by GNU C version egcs-2.92.11 19980926 (gcc2 ss-980609 experimental).

Program received signal SIGSEGV, Segmentation fault.
0x818704e in convert_regs () at ../../cvs-snap/egcs/gcc/reg-stack.c:3065
3065                  block_stack_in[block].reg[++block_stack_in[block].top] = reg;
(gdb) bt
#0  0x818704e in convert_regs () at ../../cvs-snap/egcs/gcc/reg-stack.c:3065
#1  0x818395c in reg_to_stack (first=0x82e2c08, file=0x0)
    at ../../cvs-snap/egcs/gcc/reg-stack.c:519
#2  0x80a8699 in rest_of_compilation (decl=0x82e4b04)
    at ../../cvs-snap/egcs/gcc/toplev.c:3831
#3  0x811cf6e in output_inline_function (fndecl=0x82e4b04)
    at ../../cvs-snap/egcs/gcc/integrate.c:3453
#4  0x8074479 in finish_file () at ../../../cvs-snap/egcs/gcc/cp/decl2.c:3570
#5  0x80a16c7 in finish_translation_unit ()
    at ../../../cvs-snap/egcs/gcc/cp/semantics.c:1147
#6  0x80817f5 in yyparse () at parse.y:338
#7  0x80a7044 in compile_file (name=0x804786f "z.ii")
    at ../../cvs-snap/egcs/gcc/toplev.c:2773
#8  0x80a9b43 in main (argc=8, argv=0x80476e8)
    at ../../cvs-snap/egcs/gcc/toplev.c:4847
#9  0x8048fbc in __start ()


Any idea why this is happening???

shigeya



More information about the Gcc-bugs mailing list