Add testcase for incorrect optimization in Ada
gcc/testsuite/ * gnat.dg/div_zero.adb: New test.
This commit is contained in:
parent
3c7067cc92
commit
825e5599f3
23
gcc/testsuite/gnat.dg/div_zero.adb
Normal file
23
gcc/testsuite/gnat.dg/div_zero.adb
Normal file
@ -0,0 +1,23 @@
|
||||
-- { dg-do run }
|
||||
|
||||
-- This test requires architecture- and OS-specific support code for unwinding
|
||||
-- through signal frames (typically located in *-unwind.h) to pass. Feel free
|
||||
-- to disable it if this code hasn't been implemented yet.
|
||||
|
||||
procedure Div_Zero is
|
||||
|
||||
pragma Suppress (All_Checks);
|
||||
|
||||
function Zero return Integer is
|
||||
begin
|
||||
return 0;
|
||||
end;
|
||||
|
||||
D : Integer := Zero;
|
||||
|
||||
begin
|
||||
D := 1 / D;
|
||||
raise Program_Error;
|
||||
exception
|
||||
when Constraint_Error => null;
|
||||
end;
|
Loading…
Reference in New Issue
Block a user