public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-2159] [Ada] Fix violation of No_Implicit_Loops restriction for enumeration type
Date: Thu,  8 Jul 2021 13:37:30 +0000 (GMT)	[thread overview]
Message-ID: <20210708133730.6D6AE39874C3@sourceware.org> (raw)

https://gcc.gnu.org/g:a9c3a4975013a9c3e29c03af5a1d0772d81aba12

commit r12-2159-ga9c3a4975013a9c3e29c03af5a1d0772d81aba12
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Mon May 31 16:32:14 2021 +0200

    [Ada] Fix violation of No_Implicit_Loops restriction for enumeration type
    
    gcc/ada/
    
            * exp_imgv.adb: Add with and use clause for Restrict and Rident.
            (Build_Enumeration_Image_Tables): Do not generate the hash function
            if the No_Implicit_Loops restriction is active.

Diff:
---
 gcc/ada/exp_imgv.adb | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb
index 6e17a5c452a..d2605fbe049 100644
--- a/gcc/ada/exp_imgv.adb
+++ b/gcc/ada/exp_imgv.adb
@@ -37,6 +37,8 @@ with Namet;          use Namet;
 with Nmake;          use Nmake;
 with Nlists;         use Nlists;
 with Opt;            use Opt;
+with Restrict;       use Restrict;
+with Rident;         use Rident;
 with Rtsfind;        use Rtsfind;
 with Sem_Aux;        use Sem_Aux;
 with Sem_Res;        use Sem_Res;
@@ -160,6 +162,8 @@ package body Exp_Imgv is
              Expression          => Make_Aggregate (Loc, Expressions => V)));
       end Append_Table_To;
 
+   --  Start of Build_Enumeration_Image_Tables
+
    begin
       --  Nothing to do for types other than a root enumeration type
 
@@ -247,7 +251,7 @@ package body Exp_Imgv is
       Append_Table_To (Act, Eind, Nlit, Ityp, Ind);
 
       --  If the number of literals is not greater than Threshold, then we are
-      --  done. Otherwise we compute a (perfect) hash function for use by the
+      --  done. Otherwise we generate a (perfect) hash function for use by the
       --  Value attribute.
 
       if Nlit > Threshold then
@@ -283,11 +287,12 @@ package body Exp_Imgv is
 
          --  If the unit where the type is declared is the main unit, and the
          --  number of literals is greater than Threshold_For_Size when we are
-         --  optimizing for size, and -gnatd_h is not specified, try to compute
-         --  the hash function.
+         --  optimizing for size, and the restriction No_Implicit_Loops is not
+         --  active, and -gnatd_h is not specified, generate the hash function.
 
          if In_Main_Unit
            and then (Optimize_Size = 0 or else Nlit > Threshold_For_Size)
+           and then not Restriction_Active (No_Implicit_Loops)
            and then not Debug_Flag_Underscore_H
          then
             declare


                 reply	other threads:[~2021-07-08 13:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210708133730.6D6AE39874C3@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).