public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Preelaborate rules not fully enforced
@ 2020-10-16  7:35 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-10-16  7:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: Arnaud Charlet

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

In particular RM10.2.1(8) states:

    5 An elaborable construct is preelaborable unless its elaboration
    performs any of the following actions:

    ...

    8 The evaluation of a primary that is a name of an object, unless
    the name is a static expression, or statically denotes a
    discriminant of an enclosing type.

which isn't enforced in the case of an object referenced in a range, as
in:

   S : String (1 .. X);

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

gcc/ada/

	* sem_cat.adb (Is_Primary): Handle N_Range properly.

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

diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
--- a/gcc/ada/sem_cat.adb
+++ b/gcc/ada/sem_cat.adb
@@ -2121,6 +2121,7 @@ package body Sem_Cat is
                | N_Index_Or_Discriminant_Constraint
                | N_Membership_Test
                | N_Op
+               | N_Range
             =>
                return True;
 



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

only message in thread, other threads:[~2020-10-16  7:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16  7:35 [Ada] Preelaborate rules not fully enforced 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).