gnu/gcc/897cba5b334294bc5c9f184764f9395f0c628fcf Ada: Fix ICE in fld_incomplete_type_of when building GtkAda with LTO
This is a regression from GCC 9 present on mainline and all active branches:
the compilation of GtkAda in LTO mode trips on the assertion present in the
fld_incomplete_type_of function about the TYPE_CANONICAL of types pointed to
by pointer (or reference) types. The problem comes from an oversight in the
update_pointer_to function on gcc-interface, which correctly propagates the
TYPE_CANONICAL of the new pointer type to the old one when there is a new
pointer type, but fails to synthesize it when there is no new pointer type.
gcc/ada/
PR ada/123060
* gcc-interface/utils.cc (update_pointer_to): Synthesize a new
TYPE_CANONICAL for the old pointer type in the case where there
is no new pointer type. Likewise for references.
gcc/testsuite/
* gnat.dg/lto30.ads, gnat.dg/lto30.adb: New test.
3 files changed