https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124623
Bug ID: 124623
Summary: infinite loop from access-to-protected-subprogram used
as discriminant within the declaration of its object
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: liam at liampwll dot com
CC: dkm at gcc dot gnu.org
Target Milestone: ---
Created attachment 64010
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64010&action=edit
reproducer
This came up while implementing a proof-of-concept for this proposal:
https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues/172
When a protected type declaration contains a protected subprogram and an object
which uses that protected subprogram as a discriminant, GNAT gets stuck in a
loop. With assertions enabled this instead produces a bug box.
I am not entirely certain that this code is legal, although I can not find any
indication that it would be illegal in the RM, and either way an infinite loop
is bad.
A reproducer is attached. I have not investigated the cause of this yet, I will
likely do so at some point in the future if no one else has, but it seems like
a low priority if I am the first person to ever try this.