public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/114708] New: Creating access to an incomplete formal in a generic package sometimes causes GNAT to crash
@ 2024-04-13 1:28 jhb.chat at gmail dot com
2024-04-20 15:03 ` [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package ebotcazou at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jhb.chat at gmail dot com @ 2024-04-13 1:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114708
Bug ID: 114708
Summary: Creating access to an incomplete formal in a generic
package sometimes causes GNAT to crash
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: jhb.chat at gmail dot com
CC: dkm at gcc dot gnu.org
Target Milestone: ---
Created attachment 57939
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57939&action=edit
incomplete formal example
When making a generic package that takes an incomplete formal as a parameter
and then creating an access type to that formal type inside the generic, GNAT
will crash if an actual incomplete type is supplied in the generic
instantiation.
This happens on gnat 13.0, on mwys2, Windows 10 Home, fully patched
GNATMAKE 13.2.0
Copyright (C) 1995-2023, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Checked Godbolt and this happens on trunk there and the ICE appeared to start
with GNAT 12.1 as GNAT 11.4 did not trigger the crash (on Godbolt).
Example:
procedure Main is
generic
type Element_Type(<>);
package Test_Incomplete_Formal is
type Element_Access is access Element_Type;
end Test_Incomplete_Formal;
type Node;
package P is new Test_Incomplete_Formal(Node);
type Node is limited null record;
begin
null;
end Main;
Output:
$ gnatmake.exe main.adb
gcc -c main.adb
+===========================GNAT BUG DETECTED==============================+
| 13.2.0 (x86_64-w64-mingw32) Program_Error EXCEPTION_ACCESS_VIOLATION |
| Error detected at main.adb:6:7 [main.adb:11:4] |
| Compiling main.adb |
| 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).
main.adb
compilation abandoned
gnatmake: "main.adb" compilation error
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package
2024-04-13 1:28 [Bug ada/114708] New: Creating access to an incomplete formal in a generic package sometimes causes GNAT to crash jhb.chat at gmail dot com
@ 2024-04-20 15:03 ` ebotcazou at gcc dot gnu.org
2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-20 15:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114708
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Summary|Creating access to an |[12/13/14 regression]
|incomplete formal in a |internal error on access to
|generic package sometimes |an incomplete formal in
|causes GNAT to crash |generic package
Last reconfirmed| |2024-04-20
Ever confirmed|0 |1
--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Confirmed as a regression in GCC 12 and later.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package
2024-04-13 1:28 [Bug ada/114708] New: Creating access to an incomplete formal in a generic package sometimes causes GNAT to crash jhb.chat at gmail dot com
2024-04-20 15:03 ` [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package ebotcazou at gcc dot gnu.org
@ 2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
2024-04-21 9:21 ` ebotcazou at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-20 15:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114708
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ebotcazou at gcc dot gnu.org
--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I'll have a look.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package
2024-04-13 1:28 [Bug ada/114708] New: Creating access to an incomplete formal in a generic package sometimes causes GNAT to crash jhb.chat at gmail dot com
2024-04-20 15:03 ` [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package ebotcazou at gcc dot gnu.org
2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
@ 2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
2024-04-21 9:21 ` ebotcazou at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-20 15:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114708
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package
2024-04-13 1:28 [Bug ada/114708] New: Creating access to an incomplete formal in a generic package sometimes causes GNAT to crash jhb.chat at gmail dot com
` (2 preceding siblings ...)
2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
@ 2024-04-21 9:21 ` ebotcazou at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-21 9:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114708
--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This appears to be sufficient:
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 04d114694ab..f81380846e0 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -6076,6 +6076,12 @@ package body Exp_Util is
Utyp := Underlying_Type (Base_Type (Utyp));
+ -- Handle incomplete types
+
+ if No (Utyp) then
+ return Empty;
+ end if;
+
-- Deal with untagged derivation of private views. If the parent is
-- now known to be protected, the finalization routine is the one
-- defined on the corresponding record of the ancestor (corresponding
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-21 9:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-13 1:28 [Bug ada/114708] New: Creating access to an incomplete formal in a generic package sometimes causes GNAT to crash jhb.chat at gmail dot com
2024-04-20 15:03 ` [Bug ada/114708] [12/13/14 regression] internal error on access to an incomplete formal in generic package ebotcazou at gcc dot gnu.org
2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
2024-04-20 15:04 ` ebotcazou at gcc dot gnu.org
2024-04-21 9:21 ` ebotcazou at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).