This is the mail archive of the 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]

[gfortran] Fix PR 19543: Type mismatch when building logical constants

Logical constants were build with type NULL_TREE (i.e. the host's integer
type) which lead to problems when a LOGICAL type wider than int was specified.
 Fixed by this patch, which I will commit as obviously correct along with a
testcase once the testsuite ran successfully.

- Tobi

2005-01-21  Tobias Schl"uter  <>

	PR fortran/19543
	* trans-const.c (gfc_conv_constant_to_tree): Give logical
	constants the correct type.

Index: trans-const.c
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-const.c,v
retrieving revision 1.20
diff -u -p -r1.20 trans-const.c
--- trans-const.c       8 Jan 2005 20:18:53 -0000       1.20
+++ trans-const.c       21 Jan 2005 22:32:57 -0000
@@ -306,7 +306,8 @@ gfc_conv_constant_to_tree (gfc_expr * ex
       return gfc_conv_mpfr_to_tree (expr->value.real, expr->ts.kind);

     case BT_LOGICAL:
-      return build_int_cst (NULL_TREE, expr->value.logical);
+      return build_int_cst (gfc_get_logical_type (expr->ts.kind),
+                           expr->value.logical);

     case BT_COMPLEX:

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