This is the mail archive of the gcc-cvs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

r262714 - in /trunk/gcc/ada: ChangeLog sem_eval...


Author: pmderodat
Date: Mon Jul 16 14:11:04 2018
New Revision: 262714

URL: https://gcc.gnu.org/viewcvs?rev=262714&root=gcc&view=rev
Log:
[Ada] Spurious possible contraint error warning with No_Exception_Propagation

This patch corrects an issue whereby spurious unhandled exception warnings on
integer literals within static if and case expressions would be emitted when
the restriction No_Exception_Propagation is enabled.

------------
-- Source --
------------

--  gnat.adc

pragma Restrictions (No_Exception_Propagation);
pragma SPARK_Mode (On);

--  pack.ads

package Pack is
   procedure Filter (Ret : out Integer);
end Pack;

--  pack.adb

package body Pack is

   subtype Nat is Integer range 0 .. 10;

   Default       : constant Nat := 1;
   User_Override : constant Integer := -1;

   procedure Filter (Ret : out Integer) is
      Val : constant Nat :=
              (if User_Override in Nat then
                  User_Override
               else
                  Default);
   begin
      Ret := Val;
   end Filter;
end Pack;

----------------------------
-- Compilation and output --
----------------------------

& gcc -c -gnatp -gnatwa pack.adb

2018-07-16  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* sem_eval.adb (Eval_Integer_Literal): Add exception for avoiding
	checks on expanded literals within if and case expressions.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_eval.adb


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]