https://gcc.gnu.org/g:3b4d5b340a861b29eff40811c6c6638f54c28bf6

commit r15-1288-g3b4d5b340a861b29eff40811c6c6638f54c28bf6
Author: Steve Baird <ba...@adacore.com>
Date:   Fri May 3 16:50:00 2024 -0700

    ada: Compiler goes into loop
    
    In some cases that are difficult to characterize, the compiler fails an
    assertion check (if the compiler is built with assertions enabled) or
    loops forever (if assertions are not enabled). One way this can happen is if
    Exp_Util.Insert_Actions is called with an N_Itype_Reference node as its 
first
    parameter. This, in turn, can happen when an instance of
    Exp_Attr.Expand_N_Attribute_Reference.Built_And_Insert_Type_Attr_Subp
    calls Insert_Action (which will call Insert_Actions).
    
    gcc/ada/
    
            * exp_util.adb
            (Insert_Actions): Code was relying on an incorrect assumption that 
an
            N_Itype_Reference cannot occur in declaration list or a statement
            list.  Fix the code to handle this case.

Diff:
---
 gcc/ada/exp_util.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 3307f816d152..58ab557a2504 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -8101,6 +8101,10 @@ package body Exp_Util is
                | N_Task_Body
                | N_Task_Body_Stub
 
+               --  Other things that can occur in stmt or decl lists
+
+               | N_Itype_Reference
+
                --  Use clauses can appear in lists of declarations
 
                | N_Use_Package_Clause
@@ -8370,7 +8374,6 @@ package body Exp_Util is
                | N_Integer_Literal
                | N_Iterator_Specification
                | N_Interpolated_String_Literal
-               | N_Itype_Reference
                | N_Label
                | N_Loop_Parameter_Specification
                | N_Mod_Clause

Reply via email to