GIMPLE types merging in LTO compiler

Richard Guenther
Fri May 14 11:50:00 GMT 2010

On Fri, May 14, 2010 at 1:24 PM, Eric Botcazou <> wrote:
> Hi,
> most of the remaining warnings issued by the LTO compiler on object files
> compiled from Ada are caused by a small flaw in the GIMPLE types merging
> process: it is done before symbols are merged so compatible types (typically
> domain types of arrays) whose distinguishing features depend on symbols
> (variable bounds for domain types of arrays) aren't recognized as such if the
> first type references one instance of the symbol (e.g. the "prevailing" one)
> and the second type references another instance of the same symbol.
> What's the best approach to addressing this?  Thanks in advance.

Ugh.  This presents a chicken-and-egg problem to symbol resolution
and type-merging.

To be clear, the issue is sth like

int size;
int a[size];

extern int size;
extern a[size];

?  And you get the a's merged but a diagnostic about mismatched types?

One way to fix this would be to simply detect the situation and never
issue a diagnostic.  Another way would be to delay the diagnostics
until after all types and symbols are merged.  The natural place
for this would be lto_symtab_merge_cgraph_nodes () which already
is after type merging and still has all candidates available.


> --
> Eric Botcazou

More information about the Gcc mailing list