re PR target/35662 (gfortran interfaces badly with glibc sincosf() causing breakage)
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Apr 2008 15:56:58 +0000 (17:56 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 16 Apr 2008 15:56:58 +0000 (17:56 +0200)
PR target/35662
* f95-lang.c (gfc_init_builtin_functions): Make sure
BUILT_IN_SINCOS{,F,L} types aren't varargs.

* gfortran.dg/pr35662.f90: New test.

From-SVN: r134349

gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr35662.f90 [new file with mode: 0644]

index dd5ef5bef6a01953a6157ec836c41d5b2a8d1fe2..f7ed06b370821f2970044c24c5775c6aa83583c4 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/35662
+       * f95-lang.c (gfc_init_builtin_functions): Make sure
+       BUILT_IN_SINCOS{,F,L} types aren't varargs.
+
 2008-04-15  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/35864
index eacaff82ab05c641d3826c3e9c09dd5a1ae6748f..4d2e9783af7f46f35a00ff52a5d228382d9658aa 100644 (file)
@@ -848,21 +848,21 @@ gfc_init_builtin_functions (void)
   ptype = build_pointer_type (float_type_node);
   tmp = tree_cons (NULL_TREE, float_type_node,
                   tree_cons (NULL_TREE, ptype,
-                             build_tree_list (NULL_TREE, ptype)));
+                             tree_cons (NULL_TREE, ptype, void_list_node)));
   func_float_floatp_floatp =
     build_function_type (void_type_node, tmp);
 
   ptype = build_pointer_type (double_type_node);
   tmp = tree_cons (NULL_TREE, double_type_node,
                   tree_cons (NULL_TREE, ptype,
-                             build_tree_list (NULL_TREE, ptype)));
+                             tree_cons (NULL_TREE, ptype, void_list_node)));
   func_double_doublep_doublep =
     build_function_type (void_type_node, tmp);
 
   ptype = build_pointer_type (long_double_type_node);
   tmp = tree_cons (NULL_TREE, long_double_type_node,
                   tree_cons (NULL_TREE, ptype,
-                             build_tree_list (NULL_TREE, ptype)));
+                             tree_cons (NULL_TREE, ptype, void_list_node)));
   func_longdouble_longdoublep_longdoublep =
     build_function_type (void_type_node, tmp);
 
index de3305ff0d3066142df4beaddcd66ceba1be826f..0c4c417d3329a5f34fab54e0735baa94f73b4965 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/35662
+       * gfortran.dg/pr35662.f90: New test.
+
 2008-04-16  Richard Guenther  <rguenther@suse.de>
 
        * gcc.dg/tree-ssa/loop-35.c: New testcase.
diff --git a/gcc/testsuite/gfortran.dg/pr35662.f90 b/gcc/testsuite/gfortran.dg/pr35662.f90
new file mode 100644 (file)
index 0000000..33095f0
--- /dev/null
@@ -0,0 +1,20 @@
+! PR target/35662
+! { dg-do run }
+! { dg-options "-O1" }
+
+subroutine f(x, y, z)
+  real, intent (in) :: x
+  real, intent (out) :: y, z
+  y = sin (x)
+  z = cos (x)
+end subroutine f
+
+program pr35662
+  real :: x, y, z
+  x = 3.1415926535897932384626433832795029
+  call f (x, y, z)
+  if (abs (y) > 1.0e-5 .or. abs (z + 1.0) > 1.0e-5) call abort
+  x = x / 2.0
+  call f (x, y, z)
+  if (abs (y - 1.0) > 1.0e-5 .or. abs (z) > 1.0e-5) call abort
+end program pr35662