public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Skip types in error for test to compute array size
@ 2021-07-08 13:50 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-08 13:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Yannick Moy

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

After a syntax error, if the code is compiled with -gnatq, semantic
analysis should still proceed without internal errors if possible. Add
special case to recognize ill-formed array type.

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

gcc/ada/

	* layout.adb (Layout_Type): Do not call Number_Dimensions if the
	type does not have First_Index set.

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

diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -498,6 +498,7 @@ package body Layout is
          --  in GNAT, i.e. when Packed_Array_Impl_Type is set.
 
          if Is_Array_Type (E)
+           and then Present (First_Index (E))  --  Skip types in error
            and then Number_Dimensions (E) = 1
            and then not Present (Packed_Array_Impl_Type (E))
            and then Has_Pragma_Pack (E)



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

only message in thread, other threads:[~2021-07-08 13:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 13:50 [Ada] Skip types in error for test to compute array size 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).