]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/89187 (ICE in initialize_argument_information, at calls.c:2023)
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 11:43:53 +0000 (13:43 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 11:43:53 +0000 (13:43 +0200)
Backported from mainline
2019-02-05  Jakub Jelinek  <jakub@redhat.com>

PR c++/89187
* optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
PARM_DECLs of the thunk.
* lambda.c (maybe_add_lambda_conv_op): Likewise.

* g++.dg/opt/pr89187.C: New test.

From-SVN: r275104

gcc/cp/ChangeLog
gcc/cp/lambda.c
gcc/cp/optimize.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr89187.C [new file with mode: 0644]

index 350a73f88e93fe7ff06ea30fcd2248bd311419da..9ffdf152cbbc9681a95c8e077d51409c6fd76367 100644 (file)
@@ -1,6 +1,13 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/89187
+       * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
+       PARM_DECLs of the thunk.
+       * lambda.c (maybe_add_lambda_conv_op): Likewise.
+
        2019-01-24  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/88976
index 08874794eaf3c38ba69fe137994f90521aef55fe..2ead27d8176282c5cb573f9383c211774c3e1748 100644 (file)
@@ -1045,6 +1045,9 @@ maybe_add_lambda_conv_op (tree type)
       {
        tree new_node = copy_node (src);
 
+       /* Clear TREE_ADDRESSABLE on thunk arguments.  */
+       TREE_ADDRESSABLE (new_node) = 0;
+
        if (!fn_args)
          fn_args = tgt = new_node;
        else
index 17b7f6ee7280cfe707906a215c9e6c8426771702..3d8a405b4c0f8e79b93d0b9a5e53d7e20ecdf4df 100644 (file)
@@ -403,6 +403,8 @@ maybe_thunk_body (tree fn, bool force)
                  gcc_assert (clone_parm);
                  DECL_ABSTRACT_ORIGIN (clone_parm) = NULL;
                  args[parmno] = clone_parm;
+                 /* Clear TREE_ADDRESSABLE on thunk arguments.  */
+                 TREE_ADDRESSABLE (clone_parm) = 0;
                  clone_parm = TREE_CHAIN (clone_parm);
                }
              if (fn_parm_typelist)
index 64e78f6c276151800286830698b01b011294a5ef..d4f48a63c319ac6df7bb758ea96feb63c2006386 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2019-02-05  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/89187
+       * g++.dg/opt/pr89187.C: New test.
+
        PR rtl-optimization/11304
        * gcc.target/i386/call-1.c (set_eax): Add "eax" clobber.
        * gcc.target/i386/call-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/opt/pr89187.C b/gcc/testsuite/g++.dg/opt/pr89187.C
new file mode 100644 (file)
index 0000000..3e24a8f
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/89187
+// { dg-do compile { target c++11 } }
+// { dg-options "-Os -fno-tree-ccp -fno-tree-sra -fno-inline" }
+
+template <typename T, int N> struct A {
+  typedef T __attribute__((vector_size (N))) type;
+};
+template <typename T, int N> using B = typename A<T, N>::type;
+template <typename T> using C = B<T, 4>;
+struct D {
+  D (C<int> x) : d{x[3]} {}
+  D foo () { return d; }
+  C<int> d;
+};
+extern D d;
+struct { D bar () { return d; } } l;
+struct E { void baz () const; };
+
+void
+E::baz () const
+{
+  l.bar ().foo ();
+}