https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108801
Bug ID: 108801 Summary: ICE, task’s secondary_stack_size from parent discriminant Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: simon at pushface dot org CC: dkm at gcc dot gnu.org Target Milestone: --- Created attachment 54464 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54464&action=edit Reproducer An instance of a task type is declared in a record with a discriminant Secondary_Storage_Size. The task’s Secondary_Storage_Size is specified using the record’s corresponding discriminant, like so: package Demo is type Event_Queue_Base (Secondary_Stack_Size : Natural) is tagged limited private; private task type Dispatcher (The_Queue : access Event_Queue_Base'Class; Secondary_Stack_Size : Natural) with Secondary_Stack_Size => Secondary_Stack_Size; type Event_Queue_Base (Secondary_Stack_Size : Natural) is tagged limited record The_Dispatcher : Dispatcher (Event_Queue_Base'Access, Secondary_Stack_Size => Secondary_Stack_Size); end record; end Demo; All is fine in a normal compilation, but under the Ravenscar profile (or, indeed, just pragma Restrictions (No_Implicit_Heap_Allocations)) this happens: $ gnatmake -c -u -f demo.ads gcc -c demo.ads +===========================GNAT BUG DETECTED==============================+ | 12.2.0 (x86_64-apple-darwin15) Constraint_Error erroneous memory access | | Error detected at demo.ads:14:9 | | Compiling demo.ads | | 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). demo.ads compilation abandoned gnatmake: "demo.ads" compilation error This also happens with 10.1, 11.2, but not with 9.1.