https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113688
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu.org --- Comment #13 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- This is problematic for Ada (and I don't understand why it has been backported onto the 14 branch since it touches quite a sensitive code and the issue is not a regression AFAICS). The LTO compiler relies on this machinery to recompute TYPE_CANONICAL and disregarding the size of the array field leads to nonsensical results. Ada testcase: with Ada.Strings.Bounded; package Q is package M is new Ada.Strings.Bounded.Generic_Bounded_Length (10); type T is new M.Bounded_String; Null_T : constant T; private Null_T : constant T := To_Bounded_String (""); end; with Q; procedure P is begin null; end; compiled with gnatmake p -O -flto yields: during RTL pass: expand In function 'q__m__to_bounded_string', inlined from 'q___elabs' at q.ads:12:26, inlined from 'ada_main__adainit' at /home/eric/build/gcc-14/native/tmp/b~p.adb:169:8, inlined from 'main' at /home/eric/build/gcc-14/native/tmp/b~p.adb:200:7: /home/eric/install/gcc-14/lib64/gcc/x86_64-suse-linux/14.2.1/adainclude/a-strbou.adb:101:10: internal compiler error: in expand_expr_real_2, at expr.cc:9683 101 | return To_Super_String (Source, Max_Length, Drop); | ^ 0x6eab12 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier) /home/eric/cvs/gcc-14/gcc/expr.cc:9683 because the LTO compiler wrongly removes a VIEW_CONVERT_EXPR between a dynamic record type and a static version of it, as they now incorrectly have the same TYPE_CANONICAL.