This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[gfortran,committed] Some more -fdefault-integer-8 type mismatches


Here is what I committed to fix PR32933, two mismatched-types bugs
exposed by -fdefault-integer-8. This was bootstrapped and regtested on
x86_64-linux, and committed as obvious (rev. 127334).

FX



Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog       (revision 127333)
+++ gcc/fortran/ChangeLog       (working copy)
@@ -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: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c    (revision 127333)
+++ gcc/fortran/trans-decl.c    (working copy)
@@ -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: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c       (revision 127333)
+++ gcc/fortran/trans-intrinsic.c       (working copy)
@@ -1545,7 +1545,8 @@ gfc_conv_intrinsic_minmax (gfc_se * se,
       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, g
 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_exp
   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_exp
         }
       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_exp
           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: libgfortran/ChangeLog
===================================================================
--- libgfortran/ChangeLog       (revision 127333)
+++ libgfortran/ChangeLog       (working copy)
@@ -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: libgfortran/intrinsics/associated.c
===================================================================
--- libgfortran/intrinsics/associated.c (revision 127331)
+++ libgfortran/intrinsics/associated.c (working copy)
@@ -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;


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