diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2022-01-31 09:14:41 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2022-01-31 09:15:30 +0100 |
commit | 825e5599f356608c3c48f9bcc3febec2d879261e (patch) | |
tree | 7ea91c7ba4d2c03d764c90dbd7a547092d2b17b1 | |
parent | 3c7067cc92281dcbfeaf64116d8416f2092b4c10 (diff) | |
download | gcc-825e5599f356608c3c48f9bcc3febec2d879261e.tar.gz |
Add testcase for incorrect optimization in Ada
gcc/testsuite/
* gnat.dg/div_zero.adb: New test.
-rw-r--r-- | gcc/testsuite/gnat.dg/div_zero.adb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/div_zero.adb b/gcc/testsuite/gnat.dg/div_zero.adb new file mode 100644 index 00000000000..c7237bd6ab6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/div_zero.adb @@ -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; |