This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] Fix PR 19543: Type mismatch when building logical constants
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: fortran at gcc dot gnu dot org, patch <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 21 Jan 2005 23:36:43 +0100
- Subject: [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 <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:
{