[patch] Fix LTO regression in Ada
Eric Botcazou
ebotcazou@adacore.com
Wed May 9 20:40:00 GMT 2012
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?
2012-05-09 Eric Botcazou <ebotcazou@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 <ebotcazou@adacore.com>
* gnat.dg/lto11.ad[sb]: New test.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lto11.adb
Type: text/x-adasrc
Size: 459 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120509/97afed38/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lto11.ads
Type: text/x-adasrc
Size: 198 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120509/97afed38/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 607 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120509/97afed38/attachment-0002.bin>
More information about the Gcc-patches
mailing list