This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PR 87339, testsuite] Fix failure of gcc.dg/warn-abs-1.c on some targets


Hi,

the test added to check whether _Float128 types are handled correctly by
the new warning about suspicious calls to abs-like functions fails on
many platforms.  The patch below circumvents the problem by running on
i686/x86_64 only.  I understand that the proper solution would be to
come up with a deja-gnu predicate and skip-if it was not provided but I
think that for one simple test that is a bit of an overkill and testing
it on x86_64 will provide all the test coverage we need.

Tested on x86_64-linux and aarch64-linux, testing on i686-linux
pending.  OK for trunk?

Thanks,

Martin



2018-09-24  Martin Jambor  <mjambor@suse.cz>

	PR testsuite/87339
	* gcc.dg/warn-abs-1.c: Do not test _Float128.  Remove dg-skip-if.
	* gcc.target/i386/warn-abs-3.c: New test.
---
 gcc/testsuite/gcc.dg/warn-abs-1.c          |  4 +---
 gcc/testsuite/gcc.target/i386/warn-abs-3.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/warn-abs-3.c

diff --git a/gcc/testsuite/gcc.dg/warn-abs-1.c b/gcc/testsuite/gcc.dg/warn-abs-1.c
index 129a3af8ac6..b494b14f4a9 100644
--- a/gcc/testsuite/gcc.dg/warn-abs-1.c
+++ b/gcc/testsuite/gcc.dg/warn-abs-1.c
@@ -1,5 +1,4 @@
 /* { dg-do compile { target float128 } } */
-/* { dg-skip-if "incomplete long double support" { { newlib } && large_long_double } }  */
 /* { dg-options "-Wabsolute-value" } */
 
 #include <stdlib.h>
@@ -41,12 +40,11 @@ tst_notfloat (int *pi, long *pl, complex double *pc)
 }
 
 void
-tst_float_size (double *pd, long double *pld, _Float128 *pf128)
+tst_float_size (double *pd, long double *pld)
 {
   *pd = fabsf (*pd);   /* { dg-warning "may cause truncation of value" } */
   *pld = fabs (*pld);  /* { dg-warning "may cause truncation of value" } */
   *pld = fabs ((double) *pld);
-  *pf128 = fabsl (*pf128); /* { dg-warning "may cause truncation of value" } */
 }
 
 void tst_notcomplex (int *pi, long *pl, long double *pld)
diff --git a/gcc/testsuite/gcc.target/i386/warn-abs-3.c b/gcc/testsuite/gcc.target/i386/warn-abs-3.c
new file mode 100644
index 00000000000..21feaff7d8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/warn-abs-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target float128 } } */
+/* { dg-options "-Wabsolute-value" } */
+
+#include <stdlib.h>
+#include <inttypes.h>
+#include <math.h>
+
+void
+tst_float128_size (_Float128 *pf128)
+{
+  *pf128 = fabsl (*pf128); /* { dg-warning "may cause truncation of value" } */
+}
-- 
2.18.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]