https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121058
Bug ID: 121058
Summary: GNAT bug when identically named generic function
instantiations return Implicit_Dereference types
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: dennis at przytarski dot com
CC: dkm at gcc dot gnu.org
Target Milestone: ---
Created attachment 61854
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61854&action=edit
Repro
When experimenting with the Implicit_Dereference aspect, I ran into the
following GNAT bug:
gnatmake: "<source>" compilation error
+===========================GNAT BUG DETECTED==============================+
| 16.0.0 20250713 (experimental) (x86_64-linux-gnu) GCC error: |
| in build_component_ref, at ada/gcc-interface/utils2.cc:2314 |
| Error detected at example.adb:68:18 |
This bug occurs when multiple instantiations of a generic function with the
same name (here Get) return types that use the Implicit_Dereference aspect,
causing the compiler to crash when accessing values through these functions.
Renaming one of the instantiated functions avoids the crash.
The reproducer is rather lengthy.