From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: GCC 11 bug? lawyer needed Date: Mon, 03 May 2021 17:08:20 +0100 Organization: Aioe.org NNTP Server Message-ID: NNTP-Posting-Host: yy9MKEJN2ULhWGfnfq4v5w.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) Cancel-Lock: sha1:ggy9NsvdAIhCs/mIBeV3RMQl5EM= X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:61948 List-Id: This code results in the error shown: 1. package Aliased_Tagged_Types is 2. 3. type T is tagged null record; 4. 5. function P (Param : aliased T) return Boolean 6. is (False); 7. 8. function F (Param : T) return Boolean 9. is (Param.P); | >>> actual for explicitly aliased formal is too short lived 10. 11. end Aliased_Tagged_Types; The compiler code that results in this error is at sem_ch4.adb:1490, and was introduced for Ada202x accessibiity checking reasons. -- Check whether the formal is aliased and if the accessibility -- level of the actual is deeper than the accessibility level -- of the enclosing subprogam to which the current return -- statement applies. [...] if Is_Explicitly_Aliased (Form) and then Is_Entity_Name (Act) and then Static_Accessibility_Level (Act, Zero_On_Dynamic_Level) > Subprogram_Access_Level (Current_Subprogram) then Error_Msg_N ("actual for explicitly aliased formal is too" & " short lived", Act); end if; ---- For those interested, this issue affects Alire.