c/7871: ICE on legal code, global register variables problems

Jim Wilson wilson@tuliptree.org
Fri Feb 28 03:23:00 GMT 2003


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7871

PR 7871 was broken by this patch from Richard Henderson
	http://gcc.gnu.org/ml/gcc-patches/2001-07/msg01050.html

This PR uses a global register, and a store to the global register 
before a call gets deleted as a dead store.

The problem with this patch is that it doesn't distinguish between 
regsters which are definitely set by calls, and registers which might be 
set by calls.  In both cases, we can't do optimizations like cse across 
the call.  However, only in the former case can we delete stores before 
the call as dead.  In the latter case, a store before the call is not 
dead, because the register might not be set in the call.

I think every part of the patch is right except for the flow.c change. 
The flow.c change marks global regs as killed by calls which is not 
correct.  They might be killed, but we can't assume that, because then 
we might delete a store that isn't dead.

I propose the following patch to fix the bug.  I will check it in after 
running the tests, and add the testcase to the testsuite if there isn't 
already an equivalent one.

Jim

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tmp.file
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20030228/bec9bb5b/attachment.ksh>


More information about the Gcc-bugs mailing list