Hello I am Getting "internal compiler error: in make_decl_rtl, at varasm.c:1375" during RTL optimization, but works fine if i pass value instead of variable name #g++ -c -Wno-format-truncation -Wno-narrowing MYTV/Picture.cpp -I=/usr/include/kernel-headers/ -I=/usr/include/mylog/ -I/usr/include/kernel-interfaces/ during RTL pass: expand /home/user/MY/Picture.cpp:1521:13: internal compiler error: in make_decl_rtl, at varasm.c:1375 1521 | int GammaTable[RGB_LAST][SeedCnt] = {{0,},}; /Where my seed count is 1024 | ^~~~~~~~~~~~~~~~~~ but code works fine if i pass direct Value in array -int GammaTable[RGB_LAST][SeedCnt] = {{0,},}; int GammaTable[RGB_LAST][1024] = {{0,},}; #g++ -c -Wno-format-truncation -Wno-narrowing MYTV/Picture.cpp -I=/usr/include/kernel-headers/ -I=/usr/include/mylog/ -I/usr/include/kernel-interfaces/ # Unfortunately I can share Picture.cpp code but I am trying to reproduce this issue with some sample test application
Please provide a testcase. What architecture is this on?
Working on Arm architecture. I am trying to reproduce the same with sample test case
Please find test application to reproduce this issue bash-3.2# g++ -fdump-tree-all /tmp/akhilesh.cpp during RTL pass: expand /tmp/akhilesh.cpp: In function 'int main()': /tmp/akhilesh.cpp:4:15: internal compiler error: in make_decl_rtl, at varasm.c:1375 4 | unsigned int iDefaultGammaTable[3][GammaSeedCnt] = {{0,},}; | ^~~~~~~~~~~~~~~~~~ libbacktrace could not find executable to open bash-3.2# cat /tmp/akhilesh.cpp int Seed=1024; int main() { unsigned int DefaultGammaTable[3][Seed] = {{0,},}; return 0; } even same issue is reproducible with below test case also akhilesh.k@DELL-BUILD10:~$ cat test.c int abc=1; int main() { int array[1][abc] ={0}; << But work well if we changes from 0 t0 1 return 0; }
Started with r9-6851-g187c6369c0b4c7e0.
Stack trace is below. Bisecting a test case with the initializer changed to the equivalent '{ }' points to r198746 as the first revision when GCC failed with an ICE. Prior to that, GCC rejected the code with: pr93730.C: error: variable-sized object ‘DefaultGammaTable’ may not be initialized int DefaultGammaTable[3][Seed] = {{0,},}; ^ pr93730.C:4:15: warning: unused variable ‘DefaultGammaTable’ [-Wunused-variable] 4 | unsigned int DefaultGammaTable[3][Seed] = {{0,},}; | ^~~~~~~~~~~~~~~~~ during RTL pass: expand pr93730.C:4:15: internal compiler error: in make_decl_rtl, at varasm.c:1346 4 | unsigned int DefaultGammaTable[3][Seed] = {{0,},}; | ^~~~~~~~~~~~~~~~~ 0x1af7fce make_decl_rtl(tree_node*) /src/gcc/trunk/gcc/varasm.c:1342 0x103cc40 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/trunk/gcc/expr.c:10085 0x10349d2 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/trunk/gcc/expr.c:8353 0x10122a3 expand_expr /src/gcc/trunk/gcc/expr.h:282 0x104995c expr_size(tree_node*) /src/gcc/trunk/gcc/expr.c:12652 0x1034657 expand_constructor /src/gcc/trunk/gcc/expr.c:8219 0x103e351 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/trunk/gcc/expr.c:10383 0x10349d2 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/trunk/gcc/expr.c:8353 0x10297d6 store_expr(tree_node*, rtx_def*, int, bool, bool) /src/gcc/trunk/gcc/expr.c:5747 0x10303b1 store_field /src/gcc/trunk/gcc/expr.c:7219 0x1027162 expand_assignment(tree_node*, tree_node*, bool) /src/gcc/trunk/gcc/expr.c:5369 0xe5abf4 expand_gimple_stmt_1 /src/gcc/trunk/gcc/cfgexpand.c:3749 0xe5b00e expand_gimple_stmt /src/gcc/trunk/gcc/cfgexpand.c:3847 0xe6378b expand_gimple_basic_block /src/gcc/trunk/gcc/cfgexpand.c:5887 0xe656c2 execute /src/gcc/trunk/gcc/cfgexpand.c:6542 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. *** This bug has been marked as a duplicate of bug 58646 ***
Created attachment 47875 [details] patch to fix this case Not solution for c++/58646, but this allows to work around certain case when we want to initialize VLA with zeroes. Bootstrapped on x86_64, no testsuite regressions found. Not sure about mangling: is there any ABI requirements to mangling for cases from mangle72.C?
I think VLA initialization should be rejected in C++ just as it is in C. The mangling wasn't specified the last time I checked so unless there has been some informal consensus on how to do it changing it for the member pointers shouldn't be a big problem. (They might also end up taking place as a result of the patch for pr90938 if the code gets moved from reshape_init_array_1 to process_init_constructor_array as Jason suggested.) In any case, please post your patch (for bug 58646) for consideration to gcc-patches.