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

            Bug ID: 127958
           Summary: [GCC tree-optimization] store to a _Bool field at byte
                    offset >= 2^61: FRE's eliminate builds a BIT_FIELD_REF
                    whose bit position does not fit in 64 bits, ICE in
                    tree_to_poly_uint64
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 0599jiangyc at gmail dot com
  Target Milestone: ---

The following code:
```
struct S { char a[1LL << 61]; _Bool b; };
void f (struct S *p) { p->b = 1; }
```

Resulted in this output:
```
during GIMPLE pass: fre
<source>: In function 'f':
<source>:2:16: internal compiler error: in tree_to_poly_uint64, at tree.h:5141
    2 | void f (struct S *p) { p->b = 1; }
      |                ^
0x20a13d8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x209a6cb internal_error(char const*, ...)
        ???:0
0x7c7bde fancy_abort(char const*, int, char const*)
        ???:0
0x108311e vn_reference_lookup(tree_node*, tree_node*, vn_lookup_kind,
vn_reference_s**, bool, tree_node**, tree_node*, bool)
        ???:0
0x1083b3f eliminate_dom_walker::eliminate_stmt(basic_block_def*,
gimple_stmt_iterator*)
        ???:0
/cefs/17/17a2c76db590a13a8a92c74c_consolidated/compilers_c++_x86_gcc_16.2.0/bin/../libexec/gcc/x86_64-linux-gnu/16.2.0/cc1
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/17/17a2c76db590a13a8a92c74c_consolidated/compilers_c++_x86_gcc_16.2.0/bin/../lib/gcc/x86_64-linux-gnu/16.2.0/
<source> -quiet -dumpdir /app/ -dumpbase output.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -g -O1 -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.
x86-64 gcc 16.2 - 985ms
```

Trunk: https://godbolt.org/z/875eG1Y4h

Reply via email to