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

            Bug ID: 128391
           Summary: internal compiler error: in gimplify_expr, at
                    gimplify.cc:20856
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, ice-on-invalid-fuzzy
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi,

$cat small.c
int main(void) {
  int a = 10;
  int b = 20;
  int e = a - -b;
  _Bool b = (a == 10);
  return e;
}

$gcc-trunk -c small.c
small.c: In function 'main':
small.c:5:9: error: conflicting types for 'b'; have 'bool'
    5 |   _Bool b = (a == 10);
      |         ^
small.c:3:7: note: previous definition of 'b' with type 'int'
    3 |   int b = 20;
      |       ^
small.c:4:13: internal compiler error: in gimplify_expr, at gimplify.cc:20856
    4 |   int e = a - -b;
      |           ~~^~~~
0x5f0189d internal_error(char const*, ...)
        /home/gcc/gcc/diagnostic-global-context.cc:787
0x5f1cd18 fancy_abort(char const*, int, char const*)
        /home/gcc/gcc/diagnostics/context.cc:1813
0x1b2672e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/gcc/gcc/gimplify.cc:20856
0x1b29882 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/gcc/gcc/gimplify.cc:21353
0x1abc446 gimplify_modify_expr
        /home/gcc/gcc/gimplify.cc:7334
0x1b24241 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/gcc/gcc/gimplify.cc:20526
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
        /home/gcc/gcc/gimplify.cc:8577
0x1a90462 gimplify_and_add(tree_node*, gimple**)
        /home/gcc/gcc/gimplify.cc:558
0x1a9b174 gimplify_decl_expr
        /home/gcc/gcc/gimplify.cc:2083
0x1b25826 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/gcc/gcc/gimplify.cc:20723
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
        /home/gcc/gcc/gimplify.cc:8577
0x1a9b71e gimplify_statement_list
        /home/gcc/gcc/gimplify.cc:2166
0x1b276d8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/gcc/gcc/gimplify.cc:20977
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
        /home/gcc/gcc/gimplify.cc:8577
0x1a977c6 gimplify_bind_expr
        /home/gcc/gcc/gimplify.cc:1561
0x1b2586f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/gcc/gcc/gimplify.cc:20727
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
        /home/gcc/gcc/gimplify.cc:8577
0x1a9b71e gimplify_statement_list
        /home/gcc/gcc/gimplify.cc:2166
0x1b276d8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/gcc/gcc/gimplify.cc:20977
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
        /home/gcc/gcc/gimplify.cc:8577
/home/gcc/build-gcov/install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1 -quiet
-imultiarch x86_64-linux-gnu small.c -quiet -dumpbase small.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -o /tmp/ccL2l8Yw.s
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.

$gcc-trunk -v
Using built-in specs.
COLLECT_GCC=/home/gcc/build-gcov/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/gcc/build-gcov/install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/gcc/configure --prefix=/home/gcc/build-gcov/install
--disable-multilib --disable-bootstrap --disable-werror --disable-libsanitizer
--disable-nls --enable-languages=c,lto CC=gcc CXX=g++ CFLAGS='--coverage
-fprofile-arcs -ftest-coverage -g -O0' CXXFLAGS='--coverage -fprofile-arcs
-ftest-coverage -g -O0' LDFLAGS=--coverage
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20261017 (experimental) (GCC) 


Reproduced in Godbolt: https://godbolt.org/z/v6vKhd1oa

Thanks.

Reply via email to