[Bug middle-end/126775] New: [17 Regression] ICE: tree check: expected real_cst, have vector_cst in generic_simplify_MINUS_EXPR, at generic-match-6.cc:7470 with -ffinite-math-only

zsojka at seznam dot cz via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126775

            Bug ID: 126775
           Summary: [17 Regression] ICE: tree check: expected real_cst,
                    have vector_cst in generic_simplify_MINUS_EXPR, at
                    generic-match-6.cc:7470 with -ffinite-math-only
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 65285
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65285&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -ffinite-math-only testcase.c 
testcase.c: In function 'foo':
testcase.c:3:1: internal compiler error: tree check: expected real_cst, have
vector_cst in generic_simplify_MINUS_EXPR, at generic-match-6.cc:7470
    3 | void foo() { 0 - f; }
      | ^~~~
0x2ebea5d internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0x93d7b5 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /repo/gcc-trunk/gcc/tree.cc:9218
0x9f1c34 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /repo/gcc-trunk/gcc/tree.h:3831
0x9f1c34 generic_simplify_MINUS_EXPR(unsigned long, tree_code, tree_node*,
tree_node*, tree_node*)
        /repo/build-gcc-trunk-amd64/gcc/generic-match-6.cc:7470
0x11c89ec fold_binary_loc(unsigned long, tree_code, tree_node*, tree_node*,
tree_node*)
        /repo/gcc-trunk/gcc/fold-const.cc:10894
0x11e6a28 fold(tree_node*)
        /repo/gcc-trunk/gcc/fold-const.cc:13339
0xf1f2b2 c_fully_fold_internal
        /repo/gcc-trunk/gcc/c/c-fold.cc:393
0xf1f8eb c_fully_fold(tree_node*, bool, bool*, bool)
        /repo/gcc-trunk/gcc/c/c-fold.cc:124
0xe9627f c_process_expr_stmt(unsigned long, tree_node*)
        /repo/gcc-trunk/gcc/c/c-typeck.cc:13900
0xe9655d c_finish_expr_stmt(unsigned long, tree_node*)
        /repo/gcc-trunk/gcc/c/c-typeck.cc:13945
0xf0caaf c_parser_statement_after_labels
        /repo/gcc-trunk/gcc/c/c-parser.cc:8558
0xf152d6 c_parser_compound_statement_nostart
        /repo/gcc-trunk/gcc/c/c-parser.cc:7958
0xf15557 c_parser_compound_statement
        /repo/gcc-trunk/gcc/c/c-parser.cc:7172
0xf0c342 c_parser_declaration_or_fndef
        /repo/gcc-trunk/gcc/c/c-parser.cc:3354
0xf1ab4b c_parser_external_declaration
        /repo/gcc-trunk/gcc/c/c-parser.cc:2256
0xf1b9f8 c_parser_translation_unit
        /repo/gcc-trunk/gcc/c/c-parser.cc:2095
0xf1b9f8 c_parse_file()
        /repo/gcc-trunk/gcc/c/c-parser.cc:31491
0xfa3591 c_common_parse_file()
        /repo/gcc-trunk/gcc/c-family/c-opts.cc:1437
/repo/gcc-trunk/binary-trunk-20260810164908-r17-3189-gbaa4e4ddf80060-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -iprefix
/repo/gcc-trunk/binary-trunk-20260810164908-r17-3189-gbaa4e4ddf80060-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -ffinite-math-only -o /tmp/ccBfogJt.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.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20260810164908-r17-3189-gbaa4e4ddf80060-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20260810164908-r17-3189-gbaa4e4ddf80060-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260810 (experimental) (GCC)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.