public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1476] [Ada] Fix clearly unintentional dead analysis of attribute Code_Address
@ 2022-07-05  8:29 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-05  8:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7b9ae8e806d6afcf23f970fa18ce261024eb4414

commit r13-1476-g7b9ae8e806d6afcf23f970fa18ce261024eb4414
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Jun 2 17:15:22 2022 +0200

    [Ada] Fix clearly unintentional dead analysis of attribute Code_Address
    
    A new warning about unreachable code that follows calls to procedures
    with No_Return would flag a clearly unintentional dead call to
    Set_Address_Taken in analysis of Code_Address attribute.
    
    This patch resurrects the dead code, which is worth fixing regardless of
    the new warning.
    
    gcc/ada/
    
            * sem_attr.adb (Analyze_Attribute): Move call to
            Set_Address_Taken so that it is executed when the prefix
            attribute is legal.

Diff:
---
 gcc/ada/sem_attr.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 20849bf2088..5bf13d1bf19 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -3746,11 +3746,11 @@ package body Sem_Attr is
                     Ekind (Entity (P)) /= E_Procedure)
          then
             Error_Attr ("invalid prefix for % attribute", P);
-            Set_Address_Taken (Entity (P));
 
          --  Issue an error if the prefix denotes an eliminated subprogram
 
          else
+            Set_Address_Taken (Entity (P));
             Check_For_Eliminated_Subprogram (P, Entity (P));
          end if;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-05  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05  8:29 [gcc r13-1476] [Ada] Fix clearly unintentional dead analysis of attribute Code_Address Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).