public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix compile time evaluation of shift intrinsics
@ 2020-12-14 15:56 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-12-14 15:56 UTC (permalink / raw)
  To: gcc-patches; +Cc: Arnaud Charlet

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

Recent improvements to sem_eval.adb (Fold_Shift) do not take into
account that these operations should be performed on the base type.

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

gcc/ada/

	* sem_eval.adb (Fold_Shift): Compute values using the base type.

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

diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -4785,7 +4785,7 @@ package body Sem_Eval is
       Static     : Boolean := False;
       Check_Elab : Boolean := False)
    is
-      Typ : constant Entity_Id := Etype (Left);
+      Typ : constant Entity_Id := Base_Type (Etype (Left));
 
       procedure Check_Elab_Call;
       --  Add checks related to calls in elaboration code



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

only message in thread, other threads:[~2020-12-14 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 15:56 [Ada] Fix compile time evaluation of shift intrinsics 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).