re PR other/43562 (GCC ICE on optimize attribute)

PR 43562
	* reload.h (caller_save_initialized_p): Declare.
	* toplev.c (backend_init_target): Don't call
	init_caller_save but set caller_save_initialized_p
	to false.
	* caller-save.c (caller_save_initialized_p): Define.
	(init_caller_save): Check caller_save_initialized_p.
	* ira.c (ira): Call init_caller_save if flag_caller_saves.

	testsuite/
	PR 43562
	* gcc.dg/pr43562.c: New test.

From-SVN: r157849
This commit is contained in:
Jie Zhang 2010-03-31 02:44:10 +00:00 committed by Jie Zhang
parent d500b6cfc8
commit dc12b70ef2
7 changed files with 52 additions and 2 deletions

View file

@ -1,3 +1,14 @@
2010-03-31 Jie Zhang <jie@codesourcery.com>
PR 43562
* reload.h (caller_save_initialized_p): Declare.
* toplev.c (backend_init_target): Don't call
init_caller_save but set caller_save_initialized_p
to false.
* caller-save.c (caller_save_initialized_p): Define.
(init_caller_save): Check caller_save_initialized_p.
* ira.c (ira): Call init_caller_save if flag_caller_saves.
2010-03-30 Alexandre Oliva <aoliva@redhat.com>
PR debug/42977

View file

@ -40,6 +40,9 @@ along with GCC; see the file COPYING3. If not see
#include "df.h"
#include "ggc.h"
/* True if caller-save has been initialized. */
bool caller_save_initialized_p;
/* Call used hard registers which can not be saved because there is no
insn for this. */
HARD_REG_SET no_caller_save_reg_set;
@ -208,6 +211,11 @@ init_caller_save (void)
rtx address;
int i, j;
if (caller_save_initialized_p)
return;
caller_save_initialized_p = true;
CLEAR_HARD_REG_SET (no_caller_save_reg_set);
/* First find all the registers that we need to deal with and all
the modes that they can have. If we can't find a mode to use,

View file

@ -3127,6 +3127,9 @@ ira (FILE *f)
timevar_push (TV_IRA);
if (flag_caller_saves)
init_caller_save ();
if (flag_ira_verbose < 10)
{
internal_flag_ira_verbose = flag_ira_verbose;

View file

@ -349,6 +349,9 @@ extern bool elimination_target_reg_p (rtx);
/* Deallocate the reload register used by reload number R. */
extern void deallocate_reload_reg (int r);
/* True if caller-save has been reinitialized. */
extern bool caller_save_initialized_p;
/* Functions in caller-save.c: */
/* Initialize for caller-save. */

View file

@ -1,3 +1,8 @@
2010-03-31 Jie Zhang <jie@codesourcery.com>
PR 43562
* gcc.dg/pr43562.c: New test.
2010-03-30 Jason Merrill <jason@redhat.com>
PR c++/43076

View file

@ -0,0 +1,20 @@
/* { dg-options "-O0" } */
/* { dg-do compile } */
extern unsigned foo (void);
extern void bar (void);
__attribute__ ((optimize ("O2")))
void bak ()
{
unsigned a;
while (1)
{
a = foo ();
while (a)
{
a &= 1;
bar ();
}
}
}

View file

@ -2191,8 +2191,8 @@ backend_init_target (void)
/* We may need to recompute regno_save_code[] and regno_restore_code[]
after a mode change as well. */
if (flag_caller_saves)
init_caller_save ();
caller_save_initialized_p = false;
expand_dummy_function_end ();
}