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); ```