This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
cause of all the mainline Sparc regressions
- From: "David S. Miller" <davem at redhat dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: jh at suse dot cz, rth at redhat dot com, jakub at redhat dot com
- Date: Thu, 23 May 2002 04:53:48 -0700 (PDT)
- Subject: cause of all the mainline Sparc regressions
It is this change:
+Wed Mar 6 10:59:39 CET 2002 Jan Hubicka <jh@suse.cz>
+
+ * cfgcleanup.c (try_optimize_cfg): Kill blocks.
+ (try_optimize_cfg): Do not update liveness.
+ (cleanup-cfg): Loop until try_optimize_cfg and dead code
+ removal stabilizes; use delete_trivially_dead_insns.
Specifically the bit that makes delete_trivially_dead_insns
get invoked from cleanup_cfg.
It avoids this when CLEANUP_PRE_SIBCALL is set, but there is
another case where we either have to avoid delete_trivially_dead_insns
or make it smarter. That is when we are being called from
finish_eh_generation().
The reason is that the dead insn removal does not understand
REG_SAVE_AREA notes, they are like uses of the register
mentioned in such notes. Specifically the calls to count_reg_usage
does not look for these notes.
When this bug triggers, alloca()'s occuring in code using EH regions
subtract from the stack pointer using uninitialized registers because:
1) cleanup_cfg from finish_eh_generation blew away all references
to the register in the REG_SAVE_AREA note
2) optimize_save_area_alloca transformed the instructions to
use the REG_SAVE_AREA register, but all the code to initialize
that register has been deleted by #1
I would rather not add yet another CLEANUP_* flag to check for
this, because auditing for all of the cleanup_cfg calls that occur
before optimize_save_area_alloca is nontrivial. I'd rather use
some flag set by toplev when it gets past the
optimize_save_area_alloca call.
Jan, any preferences for a fix?
Maybe the best thing to do is to make delete_trivially_dead_insns look
for the REG_SAVE_AREA notes. I wonder if there is other stuff that is
getting confused up by how these REG_SAVE_AREA notes work.