public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise
@ 2023-06-25  1:06 aj at ianozi dot com
  2023-06-26 15:47 ` [Bug ada/110398] " ebotcazou at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: aj at ianozi dot com @ 2023-06-25  1:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110398
           Summary: Program_Error sem_eval.adb:4635 explicit raise
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aj at ianozi dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Tested with godbolt: https://ada.godbolt.org/z/ezqshsxzo

Also tested on version 12 (the link is using version 13).

Steps to reproduce:
1) Create "foo.ads" with:
```
package Foo is
  subtype Bar is String (1 .. 3) with 
        Dynamic_Predicate => Bar in
            "ABC" | "DEF";
end Foo;
```

2) Create "foobar.ads" with:
```
with Foo;
package Foobar is
  subtype Foo_Bar is Foo.Bar;
end Foobar;
```

3) Create "foobar-nested.ads" with:
```
package Foobar.Nested is
    function Test_Function
        (Item : Foo_Bar) return Boolean is (True);
end Foobar.Nested;
```

4) Create "example.adb" with:
```
with Foobar.Nested;
procedure Example is
  Bug : constant Boolean := Foobar.Nested.Test_Function ("ABC");
begin
  null;
end Example;
```

It fails with:
```
gcc -c -I/app/ -g -fdiagnostics-color=always -S -fverbose-asm -masm=intel -o
/app/example.s -I- <source>
gnatmake: "<source>" compilation error
+===========================GNAT BUG DETECTED==============================+
| 13.1.0 (x86_64-linux-gnu) Program_Error sem_eval.adb:4635 explicit raise |
| Error detected at example.adb:3:42                                       |
| Compiling <source>                                               |
| 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).

<source>
/app/foobar.ads
/app/foo.ads
/app/foobar-nested.ads

compilation abandoned
Compiler returned: 4
```
(I took this from godbolt but the same error happens on my local systems)

If I changed the definition of "Test_Function" to the following it works, so
I'm guessing it has to do with the subtype:
```
    function Test_Function
        (Item : Foo.Bar) return Boolean is (True);
```

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] Program_Error sem_eval.adb:4635 explicit raise
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
@ 2023-06-26 15:47 ` ebotcazou at gcc dot gnu.org
  2023-06-27  1:14 ` aj at ianozi dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-06-26 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |ebotcazou at gcc dot gnu.org
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2023-06-26

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Please read the instructions at https://gcc.gnu.org/bugs/#gnat

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] Program_Error sem_eval.adb:4635 explicit raise
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
  2023-06-26 15:47 ` [Bug ada/110398] " ebotcazou at gcc dot gnu.org
@ 2023-06-27  1:14 ` aj at ianozi dot com
  2023-06-27  1:17 ` aj at ianozi dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: aj at ianozi dot com @ 2023-06-27  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from aj at ianozi dot com ---
Created attachment 55403
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55403&action=edit
files for bug

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] Program_Error sem_eval.adb:4635 explicit raise
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
  2023-06-26 15:47 ` [Bug ada/110398] " ebotcazou at gcc dot gnu.org
  2023-06-27  1:14 ` aj at ianozi dot com
@ 2023-06-27  1:17 ` aj at ianozi dot com
  2023-06-27  6:44 ` [Bug ada/110398] internal error on call with parameter of predicated subtype ebotcazou at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: aj at ianozi dot com @ 2023-06-27  1:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from aj at ianozi dot com ---
Sorry about that.

Here's the results on my Macbook (Darwin macbook 21.6.0 Darwin Kernel Version
21.6.0: Thu Mar  9 20:12:18 PST 2023;
root:xnu-8020.240.18.700.8~1/RELEASE_ARM64_T8110 arm64):
```
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/gcc-12.1.0-aarch64/libexec/gcc/aarch64-apple-darwin21/12.1.0/lto-wrapper
Target: aarch64-apple-darwin21
Configured with: /Volumes/Miscellaneous1/src/gcc-12-aarch64/configure
--prefix=/opt/gcc-12.1.0-aarch64 --without-libiconv-prefix --disable-libmudflap
--disable-libstdcxx-pch --disable-libsanitizer --disable-libcc1
--disable-libcilkrts --disable-multilib --disable-nls
--enable-languages=c,c++,ada --host=aarch64-apple-darwin21
--target=aarch64-apple-darwin21 --build=aarch64-apple-darwin21 --without-isl
--with-build-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
--with-sysroot=
--with-specs='%{!sysroot=*:--sysroot=%:if-exists-else(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk)}' --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --with-ranlib=/usr/bin/ranlib
--with-dsymutil=/usr/bin/dsymutil --with-build-config=no --enable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.1.0 (GCC) 
```
The command is:
`gcc -c example.adb`

The result is:
```
+===========================GNAT BUG DETECTED==============================+
| 12.1.0 (aarch64-apple-darwin21) Program_Error sem_eval.adb:4631 explicit
raise|
| Error detected at example.adb:3:42                                       |
| Compiling example.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).

example.adb
foobar.ads
foo.ads
foobar-nested.ads
```

Here's `gcc -v` on debian (Linux scratch 5.10.0-23-amd64 #1 SMP Debian
5.10.179-1 (2023-05-12) x86_64 GNU/Linux) using alire:
```
Using built-in specs.
COLLECT_GCC=/home/aj/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/gcc
COLLECT_LTO_WRAPPER=/home/aj/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../src/configure
--prefix=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/install
--with-build-time-tools=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/binutils/install/bin
--enable-languages=c,ada,c++ --enable-libstdcxx --enable-libstdcxx-threads
--enable-libada --disable-nls --without-libiconv-prefix --disable-libstdcxx-pch
--enable-lto --disable-multilib --enable-threads=posix --with-gnu-ld
--with-gnu-as
--with-mpfr=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/mpfr/install
--with-gmp=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gmp/install
--with-mpc=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/mpc/install
--with-isl=/home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/isl/install
--build=x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 
```

Command `~/.config/alire/cache/dependencies/gnat_native_12.2.1_11f3b811/bin/gcc
-c example.adb` gives me:
```
+===========================GNAT BUG DETECTED==============================+
| 12.2.0 (x86_64-pc-linux-gnu) Program_Error sem_eval.adb:4631 explicit raise|
| Error detected at example.adb:3:42                                       |
| Compiling example.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).

example.adb
foobar.ads
foo.ads
foobar-nested.ads

compilation abandoned
```

I've attached all of those files in a .zip.

On gcc 13 I was using ada.godbolt.org, but if that's insufficient, and you need
me to try this on gcc13 on a local machine I can once I'm at another computer,
please let me know.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] internal error on call with parameter of predicated subtype
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
                   ` (2 preceding siblings ...)
  2023-06-27  1:17 ` aj at ianozi dot com
@ 2023-06-27  6:44 ` ebotcazou at gcc dot gnu.org
  2023-09-28  7:48 ` [Bug ada/110398] [12/13/14 regression] " ebotcazou at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-06-27  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
            Summary|Program_Error               |internal error on call with
                   |sem_eval.adb:4635 explicit  |parameter of predicated
                   |raise                       |subtype

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Thanks.  Confirmed on the mainline with an assertion failure:

eric@fomalhaut:~/build/gcc/native> gcc/gnat1 -quiet example.adb 
+===========================GNAT BUG DETECTED==============================+
| 14.0.0 20230626 (experimental) [master r14-2083-g068eba260fa]
(x86_64-suse-linux) |
| Assert_Failure sem.adb:650                                               |
| Error detected at example.adb:3:42                                       |
| Compiling example.adb

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] [12/13/14 regression] internal error on call with parameter of predicated subtype
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
                   ` (3 preceding siblings ...)
  2023-06-27  6:44 ` [Bug ada/110398] internal error on call with parameter of predicated subtype ebotcazou at gcc dot gnu.org
@ 2023-09-28  7:48 ` ebotcazou at gcc dot gnu.org
  2023-09-28  7:48 ` ebotcazou at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-09-28  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|internal error on call with |[12/13/14 regression]
                   |parameter of predicated     |internal error on call with
                   |subtype                     |parameter of predicated
                   |                            |subtype

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This compiles up to GCC 11.x

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] [12/13/14 regression] internal error on call with parameter of predicated subtype
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
                   ` (4 preceding siblings ...)
  2023-09-28  7:48 ` [Bug ada/110398] [12/13/14 regression] " ebotcazou at gcc dot gnu.org
@ 2023-09-28  7:48 ` ebotcazou at gcc dot gnu.org
  2023-10-17 10:26 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-09-28  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

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
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] [12/13/14 regression] internal error on call with parameter of predicated subtype
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
                   ` (5 preceding siblings ...)
  2023-09-28  7:48 ` ebotcazou at gcc dot gnu.org
@ 2023-10-17 10:26 ` rguenth at gcc dot gnu.org
  2023-12-20 14:59 ` ebotcazou at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-17 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|---                         |12.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] [12/13/14 regression] internal error on call with parameter of predicated subtype
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
                   ` (6 preceding siblings ...)
  2023-10-17 10:26 ` rguenth at gcc dot gnu.org
@ 2023-12-20 14:59 ` ebotcazou at gcc dot gnu.org
  2023-12-20 15:00 ` ebotcazou at gcc dot gnu.org
  2023-12-20 15:01 ` ebotcazou at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-12-20 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
https://gcc.gnu.org/g:a3626f49d64c8b81aadae61ae4fad7d4d0f9d6b8

commit r14-6711-ga3626f49d64c8b81aadae61ae4fad7d4d0f9d6b8
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Sep 28 15:53:36 2023 +0200

    ada: Fix internal error on call with parameter of predicated subtype

    The problem is that the predicated subtype does not inherit all the
required
    attributes of a string subtype with a static predicate.

    gcc/ada/

            * sem_ch3.adb (Analyze_Subtype_Declaration): Remove a short-circuit
            for subtypes without aspects when it comes to predicates.
            * sem_util.adb (Inherit_Predicate_Flags): Deal with private
subtypes
            whose full view is an Itype.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] [12/13/14 regression] internal error on call with parameter of predicated subtype
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
                   ` (7 preceding siblings ...)
  2023-12-20 14:59 ` ebotcazou at gcc dot gnu.org
@ 2023-12-20 15:00 ` ebotcazou at gcc dot gnu.org
  2023-12-20 15:01 ` ebotcazou at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-12-20 15:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
https://gcc.gnu.org/g:0251e5582b8f841681c183477db3b5055e8fab5a

commit r13-8171-g0251e5582b8f841681c183477db3b5055e8fab5a
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Sep 28 15:53:36 2023 +0200

    ada: Fix internal error on call with parameter of predicated subtype

    The problem is that the predicated subtype does not inherit all the
required
    attributes of a string subtype with a static predicate.

    gcc/ada/
            * sem_ch3.adb (Analyze_Subtype_Declaration): Remove a short-circuit
            for subtypes without aspects when it comes to predicates.
            * sem_util.adb (Inherit_Predicate_Flags): Deal with private
subtypes
            whose full view is an Itype.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/110398] [12/13/14 regression] internal error on call with parameter of predicated subtype
  2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
                   ` (8 preceding siblings ...)
  2023-12-20 15:00 ` ebotcazou at gcc dot gnu.org
@ 2023-12-20 15:01 ` ebotcazou at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2023-12-20 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|12.4                        |13.3
         Resolution|---                         |FIXED

--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixed on mainline and 13 branch.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-20 15:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25  1:06 [Bug ada/110398] New: Program_Error sem_eval.adb:4635 explicit raise aj at ianozi dot com
2023-06-26 15:47 ` [Bug ada/110398] " ebotcazou at gcc dot gnu.org
2023-06-27  1:14 ` aj at ianozi dot com
2023-06-27  1:17 ` aj at ianozi dot com
2023-06-27  6:44 ` [Bug ada/110398] internal error on call with parameter of predicated subtype ebotcazou at gcc dot gnu.org
2023-09-28  7:48 ` [Bug ada/110398] [12/13/14 regression] " ebotcazou at gcc dot gnu.org
2023-09-28  7:48 ` ebotcazou at gcc dot gnu.org
2023-10-17 10:26 ` rguenth at gcc dot gnu.org
2023-12-20 14:59 ` ebotcazou at gcc dot gnu.org
2023-12-20 15:00 ` ebotcazou at gcc dot gnu.org
2023-12-20 15:01 ` 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).