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

            Bug ID: 127560
           Summary: internal compiler error: in gimplify_expr, at
                    gimplify.cc:21371
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lu.maltsis at postgrad dot manchester.ac.uk
  Target Milestone: ---

int a() {
  return 1 > 1 >> (-1U >> -__INT_MAX__ ^ __INT_MAX__) ^ 1U ^ 1;
}
Commit: 13e24c75a812b4838242e8da7d6697d81534a30a (trunk)
https://godbolt.org/z/WY3odTnq7

$ gcc /tmp/bug.c
/tmp/bug.c: In function ‘a’:
/tmp/bug.c:2:24: warning: right shift count is negative
[-Wshift-count-negative]
    2 |   return 1 > 1 >> (-1U >> -__INT_MAX__ ^ __INT_MAX__) ^ 1U ^ 1;
      |                        ^~
/tmp/bug.c:2:3: internal compiler error: in gimplify_expr, at gimplify.cc:21371
    2 |   return 1 > 1 >> (-1U >> -__INT_MAX__ ^ __INT_MAX__) ^ 1U ^ 1;
      |   ^~~~~~
0x27f665b internal_error(char const*, ...)
        /home/user/software/gcc/slot-a/src/gcc/diagnostic-global-context.cc:787
0xa190df fancy_abort(char const*, int, char const*)
        /home/user/software/gcc/slot-a/src/gcc/diagnostics/context.cc:1813
0x80d17c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:21371
0xe6bb64 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:21341
0xe6bb64 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:21341
0xe6bc01 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:20821
0xe8e475 gimplify_modify_expr
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:7334
0xe6c31e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:20516
0xe6e95a gimplify_stmt(tree_node**, gimple**)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:8577
0xe7f85d gimplify_and_add(tree_node*, gimple**)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:558
0xe7f85d gimplify_return_expr
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:1830
0xe6c8ed gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:20778
0xe6e95a gimplify_stmt(tree_node**, gimple**)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:8577
0xe6fff4 gimplify_bind_expr
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:1561
0xe6d530 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:20717
0xe9196a gimplify_stmt(tree_node**, gimple**)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:8577
0xe9196a gimplify_body(tree_node*, bool)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:21823
0xe91e47 gimplify_function_tree(tree_node*)
        /home/user/software/gcc/slot-a/src/gcc/gimplify.cc:22032
0xc41947 cgraph_node::analyze()
        /home/user/software/gcc/slot-a/src/gcc/cgraphunit.cc:690
0xc443a7 analyze_functions
        /home/user/software/gcc/slot-a/src/gcc/cgraphunit.cc:1269
/home/user/software/gcc/slot-a/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu /tmp/bug.c -quiet -dumpdir a- -dumpbase
bug.c -dumpbase-ext .c -mtune=generic -march=x86-64 -o /tmp/ccnX2HKI.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.

Bissection via compiler explorer:
- no ICE in 14.4: https://godbolt.org/z/Ms8s368PK
- ICE on 15.1: https://godbolt.org/z/8oGnjn8zM
  • [Bug c/127560] Ne... lu.maltsis at postgrad dot manchester.ac.uk via Gcc-bugs

Reply via email to