]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix asymmetry in resolution of unary intrinsic operators
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 26 Sep 2024 06:40:28 +0000 (08:40 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 4 Nov 2024 15:57:54 +0000 (16:57 +0100)
Resolution of binary and unary intrinsic operators differed when
expansion was inactive. In particular, this affected GNATprove
handling of Ada.Real_Time."abs" operator. This patch makes unary
resolution behave like binary resolution.

gcc/ada/ChangeLog:

* sem_res.adb (Resolve_Intrinsic_Unary_Operator): Disable when
expansion is inactive.

gcc/ada/sem_res.adb

index 6a2680b6b1da15cb1ecc2bc5b5d3901053d32bd7..0abdeee8fbee512d0b9f2419076e92556740101b 100644 (file)
@@ -9972,6 +9972,13 @@ package body Sem_Res is
       Arg2 : Node_Id;
 
    begin
+      --  We must preserve the original entity in a generic setting, so that
+      --  the legality of the operation can be verified in an instance.
+
+      if not Expander_Active then
+         return;
+      end if;
+
       Op := Entity (N);
       while Scope (Op) /= Standard_Standard loop
          Op := Homonym (Op);