https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99358

            Bug ID: 99358
           Summary: Ada2020 target assignment operator as return value
                    triggers bug box
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at schupikov dot de
  Target Milestone: ---

This issue affects the target assignment `@` in Ada2020.

If `@` is used as return value in a function, GNAT provides a bug box. Instead,
an error message describing the syntax error is expected.

Following GCC version is used:
   Target: x86_64-pc-linux-gnu
   Version: gcc version 10.2.0 (GCC)

The following code triggers the issue.

$ cat main.adb
procedure Main is
   function Test return Natural is (@);
   pragma Unreferenced (Test);
begin
   null;
end Main;

$ gnatmake -o main main.adb -gnat2020 -Wall -Wextra -gnata -gnatwa -gnatwl
-gnaty3abcefhiklmnprt
gcc -c -gnat2020 -Wall -Wextra -gnata -gnatwa -gnatwl -gnaty3abcefhiklmnprt
main.adb
+===========================GNAT BUG DETECTED==============================+
| 10.2.0 (x86_64-pc-linux-gnu) Program_Error sem_type.adb:817 explicit raise|
| Error detected at main.adb:2:37                                          |
| 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.                                       |
+==========================================================================+

Compiling:
Source file time stamp: 2021-03-03 09:54:28
Compiled at: 2021-03-03 10:54:35

     1. procedure Main is
     2.    function Test return Natural is (@);
     3.    pragma Unreferenced (Test);
     4. begin
     5.    null;
     6. end Main;

 6 lines: No errors
compilation abandoned
gnatmake: "main.adb" compilation error

Reply via email to