re PR middle-end/47566 (ICE in vn_reference_lookup)

2011-02-02  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/47566
	* builtins.c (builtin_save_expr): No SAVE_EXPR for SSA_NAMEs.

	* gcc.dg/lto/20110201-1_0.c: New testcase.

From-SVN: r169518
This commit is contained in:
Richard Guenther 2011-02-02 09:59:23 +00:00 committed by Richard Biener
parent aa8374708a
commit 5cbf5c20cf
4 changed files with 33 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2011-02-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47566
* builtins.c (builtin_save_expr): No SAVE_EXPR for SSA_NAMEs.
2011-02-02 Alexandre Oliva <aoliva@redhat.com>
PR debug/47106

View File

@ -652,9 +652,10 @@ target_char_cast (tree cst, char *p)
static tree
builtin_save_expr (tree exp)
{
if (TREE_ADDRESSABLE (exp) == 0
&& (TREE_CODE (exp) == PARM_DECL
|| (TREE_CODE (exp) == VAR_DECL && !TREE_STATIC (exp))))
if (TREE_CODE (exp) == SSA_NAME
|| (TREE_ADDRESSABLE (exp) == 0
&& (TREE_CODE (exp) == PARM_DECL
|| (TREE_CODE (exp) == VAR_DECL && !TREE_STATIC (exp)))))
return exp;
return save_expr (exp);

View File

@ -1,3 +1,8 @@
2011-02-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47566
* gcc.dg/lto/20110201-1_0.c: New testcase.
2011-02-02 Alexandre Oliva <aoliva@redhat.com>
PR debug/47498

View File

@ -0,0 +1,19 @@
/* { dg-lto-do run } */
/* { dg-lto-options { { -O0 -flto } } } */
/* { dg-extra-ld-options "-O2 -ffast-math -fuse-linker-plugin" } */
/* { dg-require-linker-plugin "" } */
/* We require a linker plugin because otherwise we'd need to link
against libm which we are not sure here has cabs on all targets.
This is because collect2 invokes ld on the -O0 object code
which does not have folded cabs. */
double cabs(_Complex double);
double __attribute__((used))
foo (_Complex double x, int b)
{
if (b)
x = 0;
return cabs(x);
}
int main() { return 0; }