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]

[Testsuite] Fix non-portable builtins tests (Solaris)


Hi,

We have these failures on Solaris:

FAIL: gcc.dg/builtins-18.c (test for excess errors)
FAIL: gcc.dg/builtins-20.c (test for excess errors)


The problem is that these tests are non-portable, namely they implicitly 
assume the presence of a C99 runtime. Now TARGET_C99_FUNCTIONS is 0 on 
Solaris.

For example, fold_builtin_cabs turns BUILT_IN_CABSL into BUILT_IN_SQRTL. Now 
BUILT_IN_SQRTL is a DEF_C99_C90RES_BUILTIN, so its 'implicit field' is 
TARGET_C99_FUNCTIONS, i.e. 0 on Solaris. As a result, fold_builtin_cabs 
can't fold cabsl.

It's the same with fold, which turns BUILT_IN_SINL/BUILT_IN_COSL into 
BUILT_IN_TANL, but BUILT_IN_TANL is a DEF_C99_C90RES_BUILTIN so its 
'implicit' field is again 0.


The patch fixes the problem on Solaris by wrapping the non-portable tests in 
#ifdef HAVE_C99_RUNTIME/#endif pairs and not defining HAVE_C99_RUNTIME on 
Solaris.


2003-10-19  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.dg/builtins-18.c: Wrap C99 tests with HAVE_C99_RUNTIME.
	Define HAVE_C99_RUNTIME except on Solaris.
	* gcc.dg/builtins-20.c: Likewise.

-- 
Eric Botcazou
Index: gcc.dg/builtins-18.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/builtins-18.c,v
retrieving revision 1.1
diff -u -r1.1 builtins-18.c
--- gcc.dg/builtins-18.c	6 Jun 2003 12:36:26 -0000	1.1
+++ gcc.dg/builtins-18.c	19 Oct 2003 08:08:03 -0000
@@ -8,6 +8,12 @@
 /* { dg-do link } */
 /* { dg-options "-O2 -ffast-math" } */
 
+
+/* Solaris doesn't have the entire C99 runtime.  */
+#ifndef sun
+#define HAVE_C99_RUNTIME
+#endif
+
 extern void link_error(void);
 
 extern float cabsf (float _Complex);
@@ -43,6 +49,7 @@
   if (__builtin_cabs (3.0 + 4.0i) != 5.0)
     link_failure ();
 
+#ifdef HAVE_C99_RUNTIME
   /* Test long doubles.  */
   if (cabsl (ldc) != 5.0L)
     link_error ();
@@ -52,6 +59,7 @@
     link_failure ();
   if (__builtin_cabsl (3.0L + 4.0iL) != 5.0L)
     link_failure ();
+#endif
 
   return 0;
 }
Index: gcc.dg/builtins-20.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/builtins-20.c,v
retrieving revision 1.1
diff -u -r1.1 builtins-20.c
--- gcc.dg/builtins-20.c	10 Jun 2003 13:05:54 -0000	1.1
+++ gcc.dg/builtins-20.c	19 Oct 2003 08:08:03 -0000
@@ -8,6 +8,12 @@
 /* { dg-do link } */
 /* { dg-options "-O2 -ffast-math" } */
 
+
+/* Solaris doesn't have the entire C99 runtime.  */
+#ifndef sun
+#define HAVE_C99_RUNTIME
+#endif
+
 extern void link_error(void);
 
 void test1(double x)
@@ -42,6 +48,7 @@
   if (cosf(x) != cosf(-x))
     link_error ();
 
+#ifdef HAVE_C99_RUNTIME
   if (sinf(x)/cosf(x) != tanf(x))
     link_error ();
 
@@ -53,6 +60,7 @@
 
   if (cosf(x)*tanf(x) != sinf(x))
     link_error ();
+#endif
 }
 
 void test2f(float x, float y)
@@ -70,6 +78,7 @@
   if (cosl(x) != cosl(-x))
     link_error ();
 
+#ifdef HAVE_C99_RUNTIME
   if (sinl(x)/cosl(x) != tanl(x))
     link_error ();
 
@@ -81,6 +90,7 @@
 
   if (cosl(x)*tanl(x) != sinl(x))
     link_error ();
+#endif
 }
 
 void test2l(long double x, long double y)

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