Bug 80784 - [7 regression] compilation failure on ACATS c732b01
Summary: [7 regression] compilation failure on ACATS c732b01
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 7.1.0
: P3 normal
Target Milestone: 7.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 80790 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-05-16 17:04 UTC by simon
Modified: 2017-05-17 12:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 6.1.0, 8.0
Known to fail:
Last reconfirmed: 2017-05-17 00:00:00


Attachments
Reproducer (12.48 KB, application/zip)
2017-05-16 17:04 UTC, simon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description simon 2017-05-16 17:04:17 UTC
Compiling the attached code, with the options used via "make check-acats", results in

$ gnatmake -gnatws -O2 c732b01.adb 
gcc -c -gnatws -O2 c732b01.adb
+===========================GNAT BUG DETECTED==============================+
| 7.1.0 (x86_64-apple-darwin15) GCC error:                                 |
| in begin_subprog_body, at ada/gcc-interface/utils.c:3297                 |
| Error detected at f732b00.ads:153:9                                      |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

c732b01.adb
f732b00.ads
report.ads

compilation abandoned
gnatmake: "c732b01.adb" compilation error

-O1 gives the same ICE, -O0 or no -O flag results in

$ gnatmake -gnatws -O0 c732b01.adb 
gcc -c -gnatws -O0 c732b01.adb
gcc -c -gnatws -O0 f732b00.adb

raised CONSTRAINT_ERROR : erroneous memory access
gnatmake: "f732b00.adb" compilation error
lockheed:c732b01 simon$ gnatmake -gnatws c732b01.adb 
gcc -c -gnatws f732b00.adb

raised CONSTRAINT_ERROR : erroneous memory access
gnatmake: "f732b00.adb" compilation error
Comment 1 simon 2017-05-16 17:04:57 UTC
Created attachment 41368 [details]
Reproducer
Comment 2 simon 2017-05-16 17:09:06 UTC
Also fails with GNAT GPL 2016.
Comment 3 Eric Botcazou 2017-05-17 12:48:35 UTC
Already fixed on mainline.
Comment 4 Eric Botcazou 2017-05-17 12:51:32 UTC
Author: ebotcazou
Date: Wed May 17 12:51:00 2017
New Revision: 248152

URL: https://gcc.gnu.org/viewcvs?rev=248152&root=gcc&view=rev
Log:
	PR ada/80784
	Backport from mainline

	2017-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch3.adb (Freeze_Type): Do not generate an invariant
	procedure body for a local (sub)type declaration within a
	predicate function. Invariant checks do not apply to these, and
	the expansion of the procedure will happen in the wrong scope,
	leading to misplaced freeze nodes.

Modified:
    branches/gcc-7-branch/gcc/ada/ChangeLog
    branches/gcc-7-branch/gcc/ada/exp_ch3.adb
Comment 5 Eric Botcazou 2017-05-17 12:52:04 UTC
.
Comment 6 Eric Botcazou 2017-05-17 12:54:53 UTC
*** Bug 80790 has been marked as a duplicate of this bug. ***