diff options
Diffstat (limited to 'gcc/ada/accessibility.adb')
-rw-r--r-- | gcc/ada/accessibility.adb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb index 8c85173..0b8d3f7 100644 --- a/gcc/ada/accessibility.adb +++ b/gcc/ada/accessibility.adb @@ -1642,6 +1642,13 @@ package body Accessibility is (No (Extra_Accessibility_Of_Result (Scope_Id)) and then Is_Formal_Of_Current_Function (Assoc_Expr) and then Is_Tagged_Type (Etype (Scope_Id))) + + -- Disable the check generation when we are only checking semantics + -- since required locals do not get generated (e.g. extra + -- accessibility of result), and constant folding can occur and + -- lead to spurious errors. + + and then not Check_Semantics_Only_Mode then -- Generate a dynamic check based on the extra accessibility of -- the result or the scope of the current function. @@ -1684,8 +1691,8 @@ package body Accessibility is and then Entity (Check_Cond) = Standard_True then Error_Msg_N - ("access discriminant in return object would be a dangling" - & " reference", Return_Stmt); + ("access discriminant in return object could be a dangling" + & " reference??", Return_Stmt); end if; end if; |