Bug in simplify_subreg?

Lars Brinkhoff lars@nocrew.org
Fri Aug 2 04:02:00 GMT 2002


In simplify-rtx.c:simplify_subreg, there is some code to simplify a
SUBREG of a hard register (starting around line 2557).  This code is
careful not to make the simplification if the register is the stack,
frame, or argument pointer.  However, if the (inner)mode is larger
than SImode, no check is made to ensure that the simplification isn't
made such that the result is one of the above pointers.

I have a situation where the second word of a DI register is allocated
to the frame pointer register (the function doesn't need a frame
pointer).  In this case, the ORIGINAL_REGNO of the frame_pointer_rtx
will be clobbered with the old pseudo REGNO (around line 2597), which
later will be referenced, causing a crash.

If I insert the same checks against final_regno as are made to
REGNO (op), everything seems to be fine.  Is this the right thing
to do?  If so, I'll test and submit a patch.

-- 
Lars Brinkhoff          http://lars.nocrew.org/     Linux, GCC, PDP-10,
Brinkhoff Consulting    http://www.brinkhoff.se/    HTTP programming



More information about the Gcc mailing list