Created attachment 38676 [details] sample source "goto *label" leads to the internal compiler error when used in nested function $ gcc main.c main.c: In function ‘test’: main.c:7:3: internal compiler error: in expand_expr_real_1, at expr.c:9651 goto *label; ^~~~ Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.archlinux.org/> for instructions.
Confirmed.
Created attachment 38680 [details] gcc7-pr71494.patch Your testcase is IMNSHO invalid, you can't combine non-local goto with computed goto together, there is either computed goto, which can branch only to labels in the same function, or non-local goto, which needs to have a non-local label as goto operand, not *expression. But, I've changed it into a valid testcase. And with the fix even the invalid testcase doesn't ICE anymore.
Author: jakub Date: Fri Jun 10 19:49:05 2016 New Revision: 237317 URL: https://gcc.gnu.org/viewcvs?rev=237317&root=gcc&view=rev Log: PR middle-end/71494 * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO without LABEL_DECL, set *handled_ops_p to false instead of true. * gcc.c-torture/execute/pr71494.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr71494.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-nested.c
Author: jakub Date: Tue Jun 14 14:45:23 2016 New Revision: 237449 URL: https://gcc.gnu.org/viewcvs?rev=237449&root=gcc&view=rev Log: Backported from mainline 2016-06-10 Jakub Jelinek <jakub@redhat.com> PR middle-end/71494 * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO without LABEL_DECL, set *handled_ops_p to false instead of true. * gcc.c-torture/execute/pr71494.c: New test. Added: branches/gcc-6-branch/gcc/testsuite/gcc.c-torture/execute/pr71494.c Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/testsuite/ChangeLog branches/gcc-6-branch/gcc/tree-nested.c
Fixed for 6.2+ so far.
Author: jakub Date: Thu Jul 7 12:43:50 2016 New Revision: 238096 URL: https://gcc.gnu.org/viewcvs?rev=238096&root=gcc&view=rev Log: Backported from mainline 2016-06-10 Jakub Jelinek <jakub@redhat.com> PR middle-end/71494 * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO without LABEL_DECL, set *handled_ops_p to false instead of true. * gcc.c-torture/execute/pr71494.c: New test. Added: branches/gcc-5-branch/gcc/testsuite/gcc.c-torture/execute/pr71494.c Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/testsuite/ChangeLog branches/gcc-5-branch/gcc/tree-nested.c
Fixed also for 5.5+.
Author: jakub Date: Thu Jul 7 21:51:57 2016 New Revision: 238143 URL: https://gcc.gnu.org/viewcvs?rev=238143&root=gcc&view=rev Log: Backported from mainline 2016-06-10 Jakub Jelinek <jakub@redhat.com> PR middle-end/71494 * tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO without LABEL_DECL, set *handled_ops_p to false instead of true. * gcc.c-torture/execute/pr71494.c: New test. Added: branches/gcc-4_9-branch/gcc/testsuite/gcc.c-torture/execute/pr71494.c Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/testsuite/ChangeLog branches/gcc-4_9-branch/gcc/tree-nested.c
Fixed.