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

            Bug ID: 117918
           Summary: ICE: tree check: expected class ‘type’, have
                    ‘exceptional’ (error_mark) in create_tmp_from_val, at
                    gimplify.cc:592
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xieym3 at zohomail dot com
  Target Milestone: ---

$ cat crash_20241204_133724_00fc.c
#include <stdlib.h>
int main(int argc, char *argv[1]) {
  int i, j;
  float arr[atoi(argv[argc])];
for ( i = 0 ; i < atoi
] ] float ( argv [ 1 ] ) ; )
  for (j = 0; j < atoi(argv[2]); j++)
    arr[i][j] = j;
return a[i][j];
}
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=/data/xieym/exp/gcc/test_data/gcc-latest-install/bin/gcc
COLLECT_LTO_WRAPPER=/data/xieym/exp/gcc/test_data/gcc-latest-install/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /data/xieym/exp/gcc/test_data/gcc-latest-src/configure
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
--prefix=/data/xieym/exp/gcc/test_data/gcc-latest-install
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.0 20241203 (experimental) (GCC)
$ gcc-trunk -x c -std=c2x crash_20241204_133724_00fc.c -o /dev/null
crash_20241204_133724_00fc.c: In function ‘main’:
crash_20241204_133724_00fc.c:5:17: warning: comparison between pointer and
integer
    5 | for ( i = 0 ; i < atoi
      |                 ^
crash_20241204_133724_00fc.c:5:23: error: expected ‘;’ before ‘]’ token
    5 | for ( i = 0 ; i < atoi
      |                       ^
      |                       ;
    6 | ] ] float ( argv [ 1 ] ) ; )
      | ~
crash_20241204_133724_00fc.c:6:1: error: expected expression before ‘]’ token
    6 | ] ] float ( argv [ 1 ] ) ; )
      | ^
crash_20241204_133724_00fc.c:6:1: error: expected statement before ‘]’ token
crash_20241204_133724_00fc.c:6:3: error: expected statement before ‘]’ token
    6 | ] ] float ( argv [ 1 ] ) ; )
      |   ^
crash_20241204_133724_00fc.c:6:13: error: ‘argv’ redeclared as different kind
of symbol
    6 | ] ] float ( argv [ 1 ] ) ; )
      |             ^~~~
crash_20241204_133724_00fc.c:2:26: note: previous definition of ‘argv’ with
type ‘char **’
    2 | int main(int argc, char *argv[1]) {
      |                    ~~~~~~^~~~~~~
crash_20241204_133724_00fc.c:6:28: error: expected statement before ‘)’ token
    6 | ] ] float ( argv [ 1 ] ) ; )
      |                            ^
crash_20241204_133724_00fc.c:8:11: error: subscripted value is neither array
nor pointer nor vector
    8 |     arr[i][j] = j;
      |           ^
crash_20241204_133724_00fc.c:9:8: error: ‘a’ undeclared (first use in this
function)
    9 | return a[i][j];
      |        ^
crash_20241204_133724_00fc.c:9:8: note: each undeclared identifier is reported
only once for each function it appears in
crash_20241204_133724_00fc.c:4:3: internal compiler error: tree check: expected
class ‘type’, have ‘exceptional’ (error_mark) in create_tmp_from_val, at
gimplify.cc:592
    4 |   float arr[atoi(argv[argc])];
      |   ^~~~~
0x56cecfc internal_error(char const*, ...)
       
/data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/diagnostic-global-context.cc:517
0x2809175 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/tree.cc:9088
0xe1bcc6 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/tree.h:3820
0x17bf8a2 create_tmp_from_val
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:592
0x17bfa3b lookup_tmp_var
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:615
0x17bffbf internal_get_tmp_var
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:670
0x17c0437 get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:714
0x17e80a5 gimplify_save_expr
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:7066
0x1845103 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:18958
0x17ecfc2 gimplify_stmt(tree_node**, gimple**)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:7840
0x17ca5e1 gimplify_statement_list
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:2256
0x184657d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:19108
0x17ecfc2 gimplify_stmt(tree_node**, gimple**)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:7840
0x17c6726 gimplify_bind_expr
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:1651
0x1844725 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:18858
0x17ecfc2 gimplify_stmt(tree_node**, gimple**)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:7840
0x17ca5e1 gimplify_statement_list
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:2256
0x184657d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:19108
0x17ecfc2 gimplify_stmt(tree_node**, gimple**)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:7840
0x184b6a7 gimplify_body(tree_node*, bool)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/gimplify.cc:19946
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to