Following code is causing ICE: $ cat ice.C template <typename a, int b> struct c { typedef a __attribute__((vector_size(b))) d; }; template <typename a, int b> using e = typename c<a, b>::d; template <typename a> using f = e<a, 4>; struct g { g(f<int> h) : i{h[3]} {} g j() { return i; } f<int> i; }; struct { g k(); } l; class m { void n() const; }; void m::n() const { l.k().j(); } $ s390x-linux-gnu-gcc ice.C -fno-tree-ccp -fno-tree-sra -flive-patching=inline-only-static -Os ice.C:12:5: warning: ‘g<unnamed struct>::k()’ used but never defined 12 | g k(); | ^ during RTL pass: expand ice.C: In constructor ‘g::g(f<int>)’: ice.C:7:26: internal compiler error: in initialize_argument_information, at calls.c:2023 7 | g(f<int> h) : i{h[3]} {} | ^ 0x580afb initialize_argument_information /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/calls.c:2023 0x580afb expand_call(tree_node*, rtx_def*, int) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/calls.c:3601 0x892cce expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/expr.c:11008 0x7a1921 expand_expr /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/expr.h:279 0x7a1921 expand_call_stmt /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/cfgexpand.c:2724 0x7a1921 expand_gimple_stmt_1 /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/cfgexpand.c:3691 0x7a1921 expand_gimple_stmt /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/cfgexpand.c:3850 0x7a344f expand_gimple_basic_block /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/cfgexpand.c:5886 0x7a8396 execute /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-s390x/build/gcc/cfgexpand.c:6509
I'm bisecting that.
It's older, one can see it with: $ s390x-linux-gnu-gcc ice.C -fno-tree-ccp -fno-tree-sra -Os -fno-inline
It's at least as old as r235033, I'm leaving bisection..
With a small adjustment and -std=c++0x -fno-tree-ccp -fno-tree-sra -Os -fno-inline template <typename a, int b> struct c { typedef a __attribute__((vector_size(b))) d; }; template <typename a, int b> using e = typename c<a, b>::d; template <typename a> using f = e<a, 4>; struct g { g(f<int> h) : i{h[3]} {} g j() { return i; } f<int> i; }; extern g gg; struct { g k() { return gg; } } l; class m { void n() const; }; void m::n() const { l.k().j(); } it was accepted by r205706 and before (back to when it wasn't accepted because missing C++11 support) and r207203 already ICEs on it, don't have around anything in between.
So, seems this is a thunk, and the vector type argument is marked addressable by convert_vector_to_array_for_subscript -> c_common_mark_addressable_vec because of the h[3].
Fixing Assignee.
Author: jakub Date: Tue Feb 5 22:28:25 2019 New Revision: 268564 URL: https://gcc.gnu.org/viewcvs?rev=268564&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/g++.dg/opt/pr89187.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/lambda.c trunk/gcc/cp/optimize.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk so far.
Author: jakub Date: Thu Feb 7 14:57:29 2019 New Revision: 268649 URL: https://gcc.gnu.org/viewcvs?rev=268649&root=gcc&view=rev Log: 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. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/opt/pr89187.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/lambda.c branches/gcc-8-branch/gcc/cp/optimize.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
Fixed for 8.3+ too.
Author: jakub Date: Fri Aug 30 11:43:53 2019 New Revision: 275104 URL: https://gcc.gnu.org/viewcvs?rev=275104&root=gcc&view=rev Log: 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. Added: branches/gcc-7-branch/gcc/testsuite/g++.dg/opt/pr89187.C Modified: branches/gcc-7-branch/gcc/cp/ChangeLog branches/gcc-7-branch/gcc/cp/lambda.c branches/gcc-7-branch/gcc/cp/optimize.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
Fixed.