public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Prevent use of an uninitialized AST field with universal integer
@ 2021-10-20 19:27 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-10-20 19:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

A temporary workaround needed by GNATprove after cleaning up the
handling of AST fields with universal integers.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

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

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 487 bytes --]

diff --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb
--- a/gcc/ada/exp_spark.adb
+++ b/gcc/ada/exp_spark.adb
@@ -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



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

only message in thread, other threads:[~2021-10-20 19:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 19:27 [Ada] Prevent use of an uninitialized AST field with universal integer 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).