[Bug c/126718] New: ICE in get_expr_operands, at tree-ssa-operands.cc:943 with __builtin_putchar ((1 ? (48) : (48)))

stuzyf at 163 dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126718

            Bug ID: 126718
           Summary: ICE in get_expr_operands, at tree-ssa-operands.cc:943
                    with __builtin_putchar ((1 ? (48) : (48)))
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Keywords: ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stuzyf at 163 dot com
  Target Milestone: ---

Reproducer:

https://godbolt.org/z/bEaWrfnPh
```
int __GIMPLE (ssa,startwith("pre"))
main ()
{
  __BB(4):
 __builtin_putchar ((1 ? (48) : (48)));
}

```

Backtrace:
```
<source>:1:5: error: '__GIMPLE' only valid with '-fgimple'
    1 | int __GIMPLE (ssa,startwith("pre"))
      |     ^~~~~~~~
<source>: In function 'main':
<source>:5:22: error: expected expression before '(' token
    5 |   __builtin_putchar ((1 ? (48) : (48)));
      |                      ^
unhandled expression in get_expr_operands():
 <error_mark 0x7c1e3d802f48>

<source>:6:1: internal compiler error: in get_expr_operands, at
tree-ssa-operands.cc:943
    6 | }
      | ^
0x2d39368 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2d2dfab internal_error(char const*, ...)
        ???:0
0xe97068 fancy_abort(char const*, int, char const*)
        ???:0
0x1895c1d operands_scanner::get_expr_operands(tree_node**, int)
        ???:0
0x18961a0 operands_scanner::parse_ssa_operands()
        ???:0
0x18970bf operands_scanner::build_ssa_operands()
        ???:0
0x18971e4 update_stmt_operands(function*, gimple*)
        ???:0
0xf73e87 c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
        ???:0
0xf6a690 c_parse_file()
        ???:0
0xfee4c9 c_common_parse_file()
        ???:0
/cefs/38/383ad2f84cbd57a52fd68bbe_consolidated/compilers_c++_x86_gcc_assertions-16.1.0/bin/../libexec/gcc/x86_64-linux-gnu/16.1.0/cc1
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/38/383ad2f84cbd57a52fd68bbe_consolidated/compilers_c++_x86_gcc_assertions-16.1.0/bin/../lib/gcc/x86_64-linux-gnu/16.1.0/
<source> -quiet -dumpdir /app/ -dumpbase output.c -dumpbase-ext .c -masm=intel
-mtune=generic -march=x86-64 -g -fdiagnostics-color=always -fno-verbose-asm -o
/app/output.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.
Compiler returned: 1

```
Reproduced with:
gcc 10.4.0, x86_64, assertions enabled (earliest version reproduced)
gcc 16.1.0, x86_64, assertions enabled (version where it was discovered)
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.