From 2276d5ed3884de91a2f81313f90fbe3e9e1781e7 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Sat, 4 Aug 2007 00:05:56 +0000 Subject: [PATCH] re PR middle-end/32304 (ICE in set_mem_attributes_minus_bitpos) 2007-08-03 Andrew Pinski PR middle-end/32304 * ipa-reference.c (has_proper_scope_for_analysis): Return false when the decl's type has TYPE_NEEDS_CONSTRUCTING set. 2007-08-03 Andrew Pinski PR middle-end/32304 * g++.dg/torture/pr32304.C: New testcase. From-SVN: r127191 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-reference.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr32304.C | 9 +++++++++ 4 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr32304.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 21f9c3a1e51..eeb4a51e0dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-08-03 Andrew Pinski + + PR middle-end/32304 + * ipa-reference.c (has_proper_scope_for_analysis): Return false when + the decl's type has TYPE_NEEDS_CONSTRUCTING set. + 2007-08-03 Andrew Pinski PR middle-end/32935 diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 5e1a6ebbaeb..1a962c52cdb 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -267,6 +267,10 @@ has_proper_scope_for_analysis (tree t) if (DECL_EXTERNAL (t) || TREE_PUBLIC (t)) return false; + /* We cannot touch decls where the type needs constructing. */ + if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (t))) + return false; + /* This is a variable we care about. Check if we have seen it before, and if not add it the set of variables we care about. */ if (!bitmap_bit_p (all_module_statics, DECL_UID (t))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7ba9afc60f1..ce38fc75bf8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-08-03 Andrew Pinski + + PR middle-end/32304 + * g++.dg/torture/pr32304.C: New testcase. + 2007-08-03 Andrew Pinski PR middle-end/32935 diff --git a/gcc/testsuite/g++.dg/torture/pr32304.C b/gcc/testsuite/g++.dg/torture/pr32304.C new file mode 100644 index 00000000000..236d00b97cd --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr32304.C @@ -0,0 +1,9 @@ +// { dg-do compile } + +struct S { + S() {} +}; +S f() { + static S s; + return s; +}