aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-02-21 01:09:47 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-02-21 01:09:47 +0100
commite843f1890b6ee39a82a05ff4a7e8a9afa11fe4f5 (patch)
treeab124504f746fe6ad9b4032d75fccece849ed9b7 /gcc
parent73ab3eb732462887817e000a23b86b8a24641c07 (diff)
downloadgcc-e843f1890b6ee39a82a05ff4a7e8a9afa11fe4f5.zip
gcc-e843f1890b6ee39a82a05ff4a7e8a9afa11fe4f5.tar.gz
gcc-e843f1890b6ee39a82a05ff4a7e8a9afa11fe4f5.tar.bz2
re PR c++/89403 (ICE in maybe_clone_body, at cp/optimize.c:693)
PR c++/89403 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting for flag_syntax_only from here... * semantics.c (expand_or_defer_fn_1): ... here. * g++.dg/cpp0x/pr89403.C: New test. From-SVN: r269059
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c5
-rw-r--r--gcc/cp/semantics.c7
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr89403.C18
5 files changed, 32 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 58df2b5..5367aae 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2019-02-20 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89403
+ * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
+ for flag_syntax_only from here...
+ * semantics.c (expand_or_defer_fn_1): ... here.
+
PR c++/89405
* decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
DECL_COMMON, set DECL_INTERFACE_KNOWN.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 72c52e3..18db79eb 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4965,11 +4965,6 @@ c_parse_final_cleanups (void)
/* Generate RTL for this function now that we know we
need it. */
expand_or_defer_fn (decl);
- /* If we're compiling -fsyntax-only pretend that this
- function has been written out so that we don't try to
- expand it again. */
- if (flag_syntax_only)
- TREE_ASM_WRITTEN (decl) = 1;
reconsider = true;
}
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 3ecd192..da814bd 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -4352,7 +4352,12 @@ expand_or_defer_fn_1 (tree fn)
/* There's no reason to do any of the work here if we're only doing
semantic analysis; this code just generates RTL. */
if (flag_syntax_only)
- return false;
+ {
+ /* Pretend that this function has been written out so that we don't try
+ to expand it again. */
+ TREE_ASM_WRITTEN (fn) = 1;
+ return false;
+ }
return true;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d8d6ef9..2068a41 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2019-02-20 Jakub Jelinek <jakub@redhat.com>
+ PR c++/89403
+ * g++.dg/cpp0x/pr89403.C: New test.
+
PR c++/89405
* g++.dg/cpp1z/inline-var5.C: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr89403.C b/gcc/testsuite/g++.dg/cpp0x/pr89403.C
new file mode 100644
index 0000000..9dc7dff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr89403.C
@@ -0,0 +1,18 @@
+// PR c++/89403
+// { dg-do compile { target c++11 } }
+// { dg-options "-Os -fsyntax-only" }
+
+template <typename T>
+struct A : T {
+ constexpr A() : T() { }
+};
+
+template <typename T>
+struct B {
+ A<T> b;
+ constexpr B() { }
+};
+
+struct C { struct {} s; };
+constexpr B<C> b{};
+constexpr C c = b.b;