On 3/31/2026 9:57 AM, Eric Botcazou wrote:
Hi,

this is a regression present on all the active branches and a sibling of:
   https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646628.html

during GIMPLE pass: dse
+===========================GNAT BUG DETECTED==============================+
| 16.0.1 20260331 (experimental) [master r16-8354-gbf6989de817] (x86_64-suse-
linux) GCC error:|
| in exact_div, at poly-int.h:2179                                         |
| Error detected around opt107.adb:26:11                                   |
| Compiling opt107.adb

So at least one caller of compute_trims, namely maybe_trim_constructor_store,
expects ref->size to be a multiple of a byte for trimming, and that's probably
the case for others in practice, from a cursory reading.  Therefore the patch
adds the same test on ref->size as the one added to ref->offset above.

Tested on x86-64/Linux, OK for all the active branches?


2026-03-31  Eric Botcazou  <[email protected]>

        * tree-ssa-dse.cc (compute_trims): Bail out if ref->size is not
        byte aligned either.


2026-03-31  Eric Botcazou  <[email protected]>

        * gnat.dg/opt107.adb: New test.
        * gnat.dg/opt107_pkg.ads: New helper.
OK
jeff

Reply via email to