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

            Bug ID: 120992
           Summary: ICE on x86_64-linux-gnu: in ubsan_instrument_division,
                    at c-family/c-ubsan.cc:51 with ubsan and alias
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jiangchangwu at smail dot nju.edu.cn
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

Compiler Explorer: https://gcc.godbolt.org/z/v4aTKW19d

*******************************************************************************
gcc version:
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++ --prefix=/home/software/gcc-trunk --enable-coverage
--disable-werror --enable-checking=yes
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250613 (experimental) (GCC)

*******************************************************************************
Program:
$ cat mutant.c
__attribute__((may_alias)) _Complex a;
void b() {
  1 / a;
}

*******************************************************************************
Command Lines:
$ gcc -fsanitize=undefined mutant.c
mutant.c: In function 'b':
mutant.c:3:3: internal compiler error: in ubsan_instrument_division, at
c-family/c-ubsan.cc:51
    3 |   1 / a;
      |   ^
0x5554b38 internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:517
0x54d2d0a fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostic.cc:1803
0x1219f7e ubsan_instrument_division(unsigned long, tree_node*, tree_node*)
        ../../gcc/gcc/c-family/c-ubsan.cc:51
0xfbd8df build_binary_op(unsigned long, tree_code, tree_node*, tree_node*,
bool)
        ../../gcc/gcc/c/c-typeck.cc:14884
0xf70200 parser_build_binary_op(unsigned long, tree_code, c_expr, c_expr)
        ../../gcc/gcc/c/c-typeck.cc:4703
0x102058f c_parser_binary_expression
        ../../gcc/gcc/c/c-parser.cc:10391
0x101c7de c_parser_conditional_expression
        ../../gcc/gcc/c/c-parser.cc:9956
0x101c1a5 c_parser_expr_no_commas
        ../../gcc/gcc/c/c-parser.cc:9869
0x10374b1 c_parser_expression
        ../../gcc/gcc/c/c-parser.cc:13973
0x1037bb9 c_parser_expression_conv
        ../../gcc/gcc/c/c-parser.cc:14032
0x101442b c_parser_statement_after_labels
        ../../gcc/gcc/c/c-parser.cc:8404
0x10118ed c_parser_compound_statement_nostart
        ../../gcc/gcc/c/c-parser.cc:7805
0x100d374 c_parser_compound_statement
        ../../gcc/gcc/c/c-parser.cc:7023
0xffac7a c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.cc:3223
0xff59fd c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.cc:2155
0xff4ea2 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.cc:2009
0x10a17ee c_parse_file()
        ../../gcc/gcc/c/c-parser.cc:30153
0x11d7aeb c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.cc:1385
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