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

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).