PR fortran/32933
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Aug 2007 13:20:46 +0000 (13:20 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Aug 2007 13:20:46 +0000 (13:20 +0000)
* trans-decl.c (gfc_build_builtin_function_decls): Change
prototype for associated.
* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Convert the
result of __builtin_isnan into a boolean.
(gfc_conv_intrinsic_strcmp): Cleanup.
(gfc_conv_associated): Convert the result of the associated
function into a boolean.

* intrinsics/associated.c: Change return type of associated into
a C int.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127334 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/fortran/trans-intrinsic.c
libgfortran/ChangeLog
libgfortran/intrinsics/associated.c

index 94dfd97..77697a7 100644 (file)
@@ -1,3 +1,14 @@
+2007-08-10  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/32933
+       * trans-decl.c (gfc_build_builtin_function_decls): Change
+       prototype for associated.
+       * trans-intrinsic.c (gfc_conv_intrinsic_minmax): Convert the
+       result of __builtin_isnan into a boolean.
+       (gfc_conv_intrinsic_strcmp): Cleanup.
+       (gfc_conv_associated): Convert the result of the associated
+       function into a boolean.
+
 2007-08-09  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/32987
index 845bbf1..cf6d9d2 100644 (file)
@@ -2286,7 +2286,6 @@ void
 gfc_build_builtin_function_decls (void)
 {
   tree gfc_int4_type_node = gfc_get_int_type (4);
-  tree gfc_logical4_type_node = gfc_get_logical_type (4);
   tree gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node);
 
   gfor_fndecl_internal_realloc =
@@ -2396,9 +2395,7 @@ gfc_build_builtin_function_decls (void)
   gfor_fndecl_associated =
     gfc_build_library_function_decl (
                                      get_identifier (PREFIX("associated")),
-                                     gfc_logical4_type_node,
-                                     2,
-                                     ppvoid_type_node,
+                                     integer_type_node, 2, ppvoid_type_node,
                                      ppvoid_type_node);
 
   gfc_build_intrinsic_function_decls ();
index ce6b585..8849e44 100644 (file)
@@ -1545,7 +1545,8 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
       if (FLOAT_TYPE_P (TREE_TYPE (limit)))
        {
          isnan = build_call_expr (built_in_decls[BUILT_IN_ISNAN], 1, limit);
-         tmp = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, tmp, isnan);
+         tmp = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, tmp,
+                            fold_convert (boolean_type_node, isnan));
        }
       tmp = build3_v (COND_EXPR, tmp, thencase, elsecase);
 
@@ -3003,15 +3004,13 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr)
 static void
 gfc_conv_intrinsic_strcmp (gfc_se * se, gfc_expr * expr, int op)
 {
-  tree type;
   tree args[4];
 
   gfc_conv_intrinsic_function_args (se, expr, args, 4);
 
   se->expr = gfc_build_compare_string (args[0], args[1], args[2], args[3]);
-  type = gfc_typenode_for_spec (&expr->ts);
-  se->expr = fold_build2 (op, type, se->expr,
-                    build_int_cst (TREE_TYPE (se->expr), 0));
+  se->expr = fold_build2 (op, gfc_typenode_for_spec (&expr->ts), se->expr,
+                         build_int_cst (TREE_TYPE (se->expr), 0));
 }
 
 /* Generate a call to the adjustl/adjustr library function.  */
@@ -3376,7 +3375,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
   gfc_se arg2se;
   tree tmp2;
   tree tmp;
-  tree fndecl;
   tree nonzero_charlen;
   tree nonzero_arraylen;
   gfc_ss *ss1, *ss2;
@@ -3437,7 +3435,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
         }
       else
         {
-
          /* An array pointer of zero length is not associated if target is
             present.  */
          arg1se.descriptor_only = 1;
@@ -3456,11 +3453,11 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
           gfc_conv_expr_descriptor (&arg2se, arg2->expr, ss2);
           gfc_add_block_to_block (&se->pre, &arg2se.pre);
           gfc_add_block_to_block (&se->post, &arg2se.post);
-          fndecl = gfor_fndecl_associated;
-          se->expr = build_call_expr (fndecl, 2, arg1se.expr, arg2se.expr);
+          se->expr = build_call_expr (gfor_fndecl_associated, 2,
+                                     arg1se.expr, arg2se.expr);
+         se->expr = convert (boolean_type_node, se->expr);
          se->expr = build2 (TRUTH_AND_EXPR, boolean_type_node,
                             se->expr, nonzero_arraylen);
-
         }
 
       /* If target is present zero character length pointers cannot
index 30ad87a..b77eeef 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-10  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/32933
+       * intrinsics/associated.c: Change return type of associated into
+       a C int.
+
 2007-08-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/33039
index d5ef556..0d32fd7 100644 (file)
@@ -30,11 +30,10 @@ Boston, MA 02110-1301, USA.  */
 
 #include "libgfortran.h"
 
-extern GFC_LOGICAL_4 associated (const gfc_array_void *,
-                                const gfc_array_void *);
+extern int associated (const gfc_array_void *, const gfc_array_void *);
 export_proto(associated);
 
-GFC_LOGICAL_4
+int
 associated (const gfc_array_void *pointer, const gfc_array_void *target)
 {
   int n, rank;