On Wed, May 9, 2012 at 10:38 PM, Eric Botcazou <ebotca...@adacore.com> wrote:
> Hi,
>
> this is a regression present on mainline and 4.7 branch.  On the attached
> testcase, the compiler aborts in LTO mode with:
>
> eric@atlantis:~/build/gcc/native32> gcc/xgcc -Bgcc -S lto11.adb -O -flto
> +===========================GNAT BUG DETECTED==============================+
> | 4.8.0 20120506 (experimental) [trunk revision 187216] (i586-suse-linux)
> | tree code 'call_expr' is not supported in LTO streams
>
> The problem is that the Ada compiler started to use DECL_ORIGINAL_TYPE in 
> 4.7.x
> and the type in this field can have arbitrary expressions as TYPE_SIZE, for
> example expressions with CALL_EXPRs.  Now the type is both not gimplified and
> streamed in LTO mode, so the CALL_EXPRs are sent to the streamer as-is.
>
> The immediate solution would be not to stream DECL_ORIGINAL_TYPE (and clear it
> in free_lang_data_in_decl), but this yields a regression in C++ with -flto -g
> (ICE in splice_child_die).  Therefore, the patch implements the alternate
> solution of gimplifying DECL_ORIGINAL_TYPE.
>
> Bootstrapped/regtested on x86_64-suse-linux, OK for mainline and 4.7 branch?

Hmm, but we will not possibly refer to the sizes therein, so emitting
stmts for them
looks pointless ... (and in fact the debug information would be odd,
too ... what
does dwarf2out.c do with these CALL_EXPRs when generating debug information
without LTO?)

Anyway, the idea is reasonable, but I'm not sure ending up with calls in those
sizes makes sense (don't we make sure to "inline" them all at some point?)

Thanks,
Richard.

>
> 2012-05-09  Eric Botcazou  <ebotca...@adacore.com>
>
>        * gimplify.c (gimplify_decl_expr): For a TYPE_DECL, gimplify the
>        DECL_ORIGINAL_TYPE if it is present.
>
>
> 2012-05-09  Eric Botcazou  <ebotca...@adacore.com>
>
>        * gnat.dg/lto11.ad[sb]: New test.
>
>
> --
> Eric Botcazou

Reply via email to