Bug 103430 - ICE in gimplify_var_or_parm_decl, at gimplify.c:2975
Summary: ICE in gimplify_var_or_parm_decl, at gimplify.c:2975
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, stmt-expr
Depends on:
Blocks: C++VLA
  Show dependency treegraph
 
Reported: 2021-11-25 17:51 UTC by Arseny Solokha
Modified: 2022-11-28 19:36 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-11-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2021-11-25 17:51:50 UTC
g:4e6bf0b9dd5585df1a1472d6a93b9fff72fe2524 fixes the long-standing issue w/ VLAs and statement expressions for the C front-end, but not for the C++ one. g++ still ICEs when compiling the following testcase, extracted from gcc/testsuite/gcc.dg/vla-stexp-9.c:

void foo(void)
{
	if (2 * sizeof(int) != sizeof((*({ int N = 2; int (*x)[9][N] = 0; x; })[1])))
		__builtin_abort();
}

% g++-12.0.0 -c mrzd2yqy.c
mrzd2yqy.c: In function 'void foo()':
mrzd2yqy.c:3:29: internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:2975
    3 |         if (2 * sizeof(int) != sizeof((*({ int N = 2; int (*x)[9][N] = 0; x; })[1])))
      |             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x7a339b gimplify_var_or_parm_decl
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:2975
0xea3e1f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:15127
0xea98e0 internal_get_tmp_var
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:624
0xeac95e get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:679
0xeac95e gimplify_save_expr
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:6267
0xea4298 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:14967
0xea3e7d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:14971
0xea3a51 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:15432
0xea3a51 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:15432
0xebbd7c gimplify_cond_expr
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:4329
0xea446c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:14623
0xea79e6 gimplify_stmt(tree_node**, gimple**)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:7024
0xea82af gimplify_bind_expr
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:1426
0xea444f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:14867
0xea79e6 gimplify_stmt(tree_node**, gimple**)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:7024
0xea82af gimplify_bind_expr
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:1426
0xea444f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:14867
0xebeb96 gimplify_stmt(tree_node**, gimple**)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:7024
0xebeb96 gimplify_body(tree_node*, bool)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:15912
0xebf02d gimplify_function_tree(tree_node*)
	/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/gimplify.c:16066
Comment 1 Martin Liška 2021-11-26 09:36:02 UTC
Confirmed.