]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Prevent use of an uninitialized AST field with universal integer
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 12 Oct 2021 15:42:05 +0000 (17:42 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 20 Oct 2021 10:17:04 +0000 (10:17 +0000)
gcc/ada/

* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Guard
against equality of an uninitialized RM_Size field.

gcc/ada/exp_spark.adb

index bbfee6229690a3562521ee9f0fadd087b0091906..bce745b2690f9c598e34d4471ec735bf05f07e1b 100644 (file)
@@ -451,6 +451,7 @@ package body Exp_SPARK is
                Apply_Universal_Integer_Attribute_Checks (N);
 
                if Present (Typ)
+                 and then Known_RM_Size (Typ)
                  and then RM_Size (Typ) = RM_Size (Standard_Long_Long_Integer)
                then
                   --  ??? This should rather be a range check, but this would