* [PATCH] Fix PR middle-end/32304 ICE with ipa-reference turning a variable needing constructing into a const variable
@ 2007-08-03 19:06 Andrew Pinski
2007-08-03 19:52 ` Diego Novillo
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2007-08-03 19:06 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 649 bytes --]
Hi,
The problem here is that ipa-reference will not ignore decls' whos
types have TYPE_NEEDS_CONSTRUCTING set. This showed only up after the
early optimization was added as the variable's address was taken
before.
This patch just adds the check for TYPE_NEEDS_CONSTRUCTING to
has_proper_scope_for_analysis so we don't run into an ICE in
set_mem_attributes_minus_bitpos.
OK? Bootstrapped and tested on i686-apple-darwin8.10 and with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* ipa-reference.c (has_proper_scope_for_analysis): Return false when
the decl's type has
TYPE_NEEDS_CONSTRUCTING set.
* g++.dg/torture/pr32304.C: New testcase.
[-- Attachment #2: fixpr32304.diff.txt --]
[-- Type: text/plain, Size: 959 bytes --]
Index: ipa-reference.c
===================================================================
--- ipa-reference.c (revision 127176)
+++ ipa-reference.c (working copy)
@@ -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)))
Index: testsuite/g++.dg/torture/pr32304.C
===================================================================
--- testsuite/g++.dg/torture/pr32304.C (revision 0)
+++ testsuite/g++.dg/torture/pr32304.C (revision 0)
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+struct S {
+ S() {}
+};
+S f() {
+ static S s;
+ return s;
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix PR middle-end/32304 ICE with ipa-reference turning a variable needing constructing into a const variable
2007-08-03 19:06 [PATCH] Fix PR middle-end/32304 ICE with ipa-reference turning a variable needing constructing into a const variable Andrew Pinski
@ 2007-08-03 19:52 ` Diego Novillo
0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2007-08-03 19:52 UTC (permalink / raw)
To: Andrew Pinski; +Cc: gcc-patches
On 8/3/07 3:06 PM, Andrew Pinski wrote:
> * ipa-reference.c (has_proper_scope_for_analysis): Return false when
> the decl's type has
> TYPE_NEEDS_CONSTRUCTING set.
>
> * g++.dg/torture/pr32304.C: New testcase.
OK.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-03 19:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-03 19:06 [PATCH] Fix PR middle-end/32304 ICE with ipa-reference turning a variable needing constructing into a const variable Andrew Pinski
2007-08-03 19:52 ` Diego Novillo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).