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

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Fri Jan 21 22:36:00 GMT 2005


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  <tobias.schlueter@physik.uni-muenchen.de>

	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:
       {



More information about the Fortran mailing list