Bug 77968 - [7 Regression] ICEs with -flto on gnat.dg
Summary: [7 Regression] ICEs with -flto on gnat.dg
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: 7.0
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2016-10-13 14:09 UTC by Richard Biener
Modified: 2016-10-14 10:41 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-10-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2016-10-13 14:09:40 UTC
When running check-gnat with -flto you'll stumble upon a load of

+===========================GNAT BUG DETECTED==============================+
| 7.0.0 20161013 (experimental) [trunk revision 221942] (x86_64-pc-linux-gnu) GCC error:|
| in self_referential_size, at stor-layout.c:187                           |

which is

          /* We shouldn't have true variables here.  */
          gcc_assert (TREE_READONLY (ref));

that's likely because of

2016-07-11  Eric Botcazou  <ebotcazou@adacore.com>

        * gcc-interface/trans.c (add_decl_expr): Minor tweak.
        * gcc-interface/utils.c (create_var_decl): For an external variable,
        also clear TREE_READONLY in LTO mode if the initializer is not a valid
        constant and set DECL_READONLY_ONCE_ELAB instead.

possibly all flag_generate_lto uses in ada/gcc-frontend are "bogus".
Comment 1 Eric Botcazou 2016-10-13 15:48:15 UTC
Egad.  Will revert the create_var_decl hunk, thanks for the heads up.
Comment 2 Eric Botcazou 2016-10-14 10:28:59 UTC
Author: ebotcazou
Date: Fri Oct 14 10:28:27 2016
New Revision: 241154

URL: https://gcc.gnu.org/viewcvs?rev=241154&root=gcc&view=rev
Log:
	PR ada/77968
	* gcc-interface/utils.c (create_var_decl): Do not clear TREE_READONLY
	in LTO mode for an external variable.
	(can_materialize_object_renaming_p): Move up.

Added:
    trunk/gcc/testsuite/gnat.dg/lto18.adb
    trunk/gcc/testsuite/gnat.dg/lto18.ads
    trunk/gcc/testsuite/gnat.dg/lto18_pkg.ads
    trunk/gcc/testsuite/gnat.dg/lto19.adb
    trunk/gcc/testsuite/gnat.dg/lto19_pkg1.adb
    trunk/gcc/testsuite/gnat.dg/lto19_pkg1.ads
    trunk/gcc/testsuite/gnat.dg/lto19_pkg2.adb
    trunk/gcc/testsuite/gnat.dg/lto19_pkg2.ads
    trunk/gcc/testsuite/gnat.dg/lto20.adb
    trunk/gcc/testsuite/gnat.dg/lto20_pkg.adb
    trunk/gcc/testsuite/gnat.dg/lto20_pkg.ads
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/gcc-interface/utils.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gnat.dg/lto15.adb
    trunk/gcc/testsuite/gnat.dg/lto16.adb
    trunk/gcc/testsuite/gnat.dg/lto17.adb
Comment 3 Eric Botcazou 2016-10-14 10:41:14 UTC
Thanks for the heads-up.