https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90325
Bug ID: 90325 Summary: GCC Error in gnat_to_gnu_entity using Unchecked_Conversion to a discriminated type in a Lock_Free protected type body Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: matsilvabustos at abc dot gob.ar Target Milestone: --- Created attachment 46277 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46277&action=edit Example scenario. A bugbox shows up with this particular scenario. It also happens in version 7.3 Full example in attachment. type T -- Any discriminant yields a gcc error in protected body PT -- No discriminant: everything ok. (i : Integer := 1) is ...; type R is record a : T; end record; function To_Access_R is new Ada.Unchecked_Conversion(...); -- GCC Error would happen if Lock_Free => True. -- Otherwise it compiles successfully. protected type PT with Lock_Free => True is ... end PT; protected body PT is function h return T is begin -- Maybe this operation is incompatible with a Lock_Free -- protected type. Anyway, GCC should show a message instead of -- bugboxing. return To_Access_R (x) . a; end h; end PT; +===========================GNAT BUG DETECTED==============================+ | 9.0.1 20190501 (prerelease) (x86_64-pc-linux-gnu) GCC error: | | in gnat_to_gnu_entity, at ada/gcc-interface/decl.c:438 | | Error detected at main.adb:30:36 | +===========================GNAT BUG DETECTED==============================+ | 7.3.1 20180712 (Red Hat 7.3.1-6) (x86_64-redhat-linux) GCC error: | | en gnat_to_gnu_entity, en ada/gcc-interface/decl.c:422 | | Error detected at main.adb:30:36 |