[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.
From-SVN: r262714