Debian Codegraph @

gcc/testsuite/gnat.dg/div_zero.adb

raw
1 -- { dg-do run }
2 -- { dg-skip-if "divide does not trap" { aarch64*-*-* powerpc*-*-* riscv*-*-* } }
3
4 -- This test requires architecture- and OS-specific support code for unwinding
5 -- through signal frames (typically located in *-unwind.h) to pass. Feel free
6 -- to disable it if this code hasn't been implemented yet.
7
8 procedure Div_Zero is
9
10 pragma Suppress (All_Checks);
11
12 function Zero return Integer is
13 begin
14 return 0;
15 end;
16
17 D : Integer := Zero;
18
19 begin
20 D := 1 / D;
21 raise Program_Error;
22 exception
23 when Constraint_Error => null;
24 end;