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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2026-12-02
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed on trunk with -fsanitize=undefined.

Simplified reproducer:
```c
struct my_string {
  char *buffer __attribute__((counted_by(length)));
  long length;
};
int y;
void foo(struct my_string *p) {
  char *x = p->buffer + (long)&y;
}
```

When pointer arithmetic on a counted_by member uses an address expression as
offset, IFN_UBSAN_BOUNDS receives the ADDR_EXPR as its index operand. In pass
sanopt, ubsan_expand_bounds_ifn calls ubsan_encode_value() with the
pointer-typed index, hitting gcc_unreachable() at ubsan.cc:162.

Reply via email to