SegFault egcs 1.1.1

Donn Terry donn@interix.com
Thu Jan 21 11:15:00 GMT 1999


I've been lurking out here for a couple of weeks, and I've run
across a problem that somebody out there may be able to provide
some clues for.  Scenario:

Create CONST1_RTX (a.k.a. const_tiny_rtx...).  It gets used in
some expression in mode DF.

emit_move_insn() will call force_const_mem().  Near the beginning
of force_const_mem(), there's a check to see if it's a 
CONST_DOUBLE, and if so if it's on the chain of CONST_DOUBLEs
for that function by looking at CONST_DOUBLE_MEM.

Near the end of the same function, it adds the constant to
the chain, and changes CONST_DOUBLE_MEM to point to the constant
symbol it has cooked up in the variable 'def'.

So far, all is reasonable.

Now we move on to the next function in the program being compiled.
We've freed the obstack in which the variable 'def' was allocated,
so now CONST_DOUBLE_MEM of CONST1_RTX is pointing into thin air.
The check at the beginning of force_const_mem() does something
with whatever value is now in memory.  Whatever it does wrong
appears to be mostly benign because egcs 1.1.1 can compile the
source program that's failing on most other machines.
(libio/floatconv.c)  (My guess, but I haven't checked it, is
that it reuses the same constant in a different function,
assuming the data structure for def isn't too trashed.)

In my case, free() can actually remove memory from the address
space, and has done so in this case, so the compiler falls over.
(Talk about a mixed blessing.)

Anyway... has this been fixed (if so, where, and how would I find it)?
If not, can anyone suggest how it should be fixed.  (Should the
constants be refreshed at the beginning of each function, or
should something else happen, or is something not happening that
should be?)  (I don't need a patch, just thoughts about direction.
Of course, a patch would be nice.)

Donn Terry

P.S.  I don't see the problem on my Intel box, just the Alpha,
even tho both of them have the same characteristic that free()
can actually release memory.
-- 

===================================================
Donn Terry                  mailto:donn@interix.com
Softway Systems, Inc.        http://www.interix.com
2850 McClelland Dr, Ste. 1800   Ft.Collins CO 80525
Tel: +1-970-204-9900           Fax: +1-970-204-9951
===================================================



More information about the Gcc mailing list