]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Spurious error on 'Image
authorArnaud Charlet <charlet@adacore.com>
Sun, 13 Dec 2020 17:58:26 +0000 (12:58 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 29 Apr 2021 08:00:43 +0000 (04:00 -0400)
gcc/ada/

* sem_attr.adb (Check_Image_Type): Protect against empty
Image_Type.

gcc/ada/sem_attr.adb

index e4537e45553307346cc01181653d6a8b5dc74d98..34865f4d1d53a7c91a789cabf13a45a3e3526bb1 100644 (file)
@@ -1466,7 +1466,11 @@ package body Sem_Attr is
 
          procedure Check_Image_Type (Image_Type : Entity_Id) is
          begin
+            --  Image_Type may be empty in case of another error detected,
+            --  or if an N_Raise_xxx_Error node is a parent of N.
+
             if Ada_Version < Ada_2020
+              and then Present (Image_Type)
               and then not Is_Scalar_Type (Image_Type)
             then
                Error_Msg_Ada_2020_Feature ("nonscalar ''Image", Sloc (P));