public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jhb.chat at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/114708] New: Creating access to an incomplete formal in a generic package sometimes causes GNAT to crash
Date: Sat, 13 Apr 2024 01:28:14 +0000	[thread overview]
Message-ID: <bug-114708-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2024-04-13  1:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13  1:28 jhb.chat at gmail dot com [this message]
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
2024-06-10 10:14 ` [Bug ada/114708] [12/13/14/15 " cvs-commit at gcc dot gnu.org
2024-06-10 10:25 ` cvs-commit at gcc dot gnu.org
2024-06-10 10:30 ` cvs-commit at gcc dot gnu.org
2024-06-10 10:34 ` cvs-commit at gcc dot gnu.org
2024-06-10 10:35 ` ebotcazou at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-114708-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).