summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-overflow-1.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-16 17:15:23 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-16 17:15:23 +0000
commitf2e0dda3066e3d34f0c5424885bf4b1e5591fd81 (patch)
tree6894347795260dbf98ccdad4e02632f18f90f9e7 /gcc/testsuite/gcc.dg/fold-overflow-1.c
parent363d487eb26583d7e66b35d055543cf7e3348dd9 (diff)
downloadgcc-f2e0dda3066e3d34f0c5424885bf4b1e5591fd81.tar.gz
* fold-const.c (const_binop): Don't constant fold the operation
if the result has overflowed and flag_trapping_math. * simplify-rtx.c (simplify_const_binary_operation): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107092 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-overflow-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/fold-overflow-1.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/fold-overflow-1.c b/gcc/testsuite/gcc.dg/fold-overflow-1.c
new file mode 100644
index 00000000000..2dd2188f870
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-overflow-1.c
@@ -0,0 +1,18 @@
+/* { dg-compile } */
+/* { dg-options "-O -ftrapping-math" } */
+
+float f1 = __FLT_MAX__ + __FLT_MAX__;
+
+float foo1(void)
+{
+ return __FLT_MAX__ + __FLT_MAX__;
+}
+
+float f2 = 1.0f/0.0f;
+
+float foo2(void)
+{
+ return 1.0f/0.0f;
+}
+
+/* { dg-final { scan-assembler-times "2139095040" 2 } } */