#1002505 gcc internal compiler error related to VLAs

Package:
gcc-11
Source:
gcc-11
Description:
GNU C compiler
Submitter:
Martin Uecker
Date:
2021-12-29 12:09:38 UTC
Severity:
normal
#1002505#5
Date:
2021-12-23 12:49:46 UTC
From:
To:
GCC 11 crashes on armel und s390x for certain
code involving VLAs. Same code builds with older
GCC:

https://buildd.debian.org/status/package.php?p=bart-view

This may also be related to a build failure on i386
for a different package:

https://salsa.debian.org/med-team/bart/-/jobs/2121098


I recently filed an upstream bug for a problem which
may also be related (but affects x86_64):

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103770


Best,
Martin

#1002505#10
Date:
2021-12-29 12:08:38 UTC
From:
To:
Minimal test case for armel:

# cat BUG.c
extern _Complex float g(int N, int dims[N]);

void f(void)
{
	int dims[1];
	_Complex float val = g(1, dims);
}

# arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (Debian 11.2.0-9) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# arm-linux-gnueabi-gcc BUG.c
during RTL pass: expand
BUG.c: In function 'f':
BUG.c:10:30: internal compiler error: Segmentation fault
   10 |         _Complex float val = g(1, dims);
      |                              ^~~~~~~~~~

0xb1393f crash_signal
	../../src/gcc/toplev.c:327
0x708398 get_size_range(range_query*, tree_node*, gimple*, tree_node**, int)
	../../src/gcc/calls.c:1274
0x70c4d4 get_size_range(range_query*, tree_node*, gimple*, tree_node**, int)
	../../src/gcc/calls.c:1266
0x70c4d4 get_size_range(tree_node*, tree_node**, int)
	../../src/gcc/calls.c:1401
0x70c4d4 maybe_warn_rdwr_sizes
	../../src/gcc/calls.c:2034
0x70dcb1 initialize_argument_information
	../../src/gcc/calls.c:2626
0x70dcb1 expand_call(tree_node*, rtx_def*, int)
	../../src/gcc/calls.c:4010
0x8210ce expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
	../../src/gcc/expr.c:11287
0x82a9ce expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
	../../src/gcc/expr.c:8519
0x82a9ce store_expr(tree_node*, rtx_def*, int, bool, bool)
	../../src/gcc/expr.c:5886
0x82be69 expand_assignment(tree_node*, tree_node*, bool)
	../../src/gcc/expr.c:5622
0x720bf9 expand_call_stmt
	../../src/gcc/cfgexpand.c:2838
0x720bf9 expand_gimple_stmt_1
	../../src/gcc/cfgexpand.c:3871
0x720bf9 expand_gimple_stmt
	../../src/gcc/cfgexpand.c:4035
0x726b97 expand_gimple_basic_block
	../../src/gcc/cfgexpand.c:6077
0x726b97 execute
	../../src/gcc/cfgexpand.c:6761
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.