[gfortran] Fix PR 19543: Type mismatch when building logical constants
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Sat Jan 22 00:51:00 GMT 2005
Paul Brook wrote:
> Yes. Patch approved (assuming it passes testing).
Thanks, a patch which resolves the issue, but leaves us with a logical type
that is essentially the same as the integer type of the same width, is below;
it avoids setting TYPE_PRECISION(type) = 1 for logical types.
Bubblestrapped and tested on i686-pc-linux. Is this together with the
attached testcase ok, or shold we hope that the backend gets fixed?
- Tobi
2005-01-22 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/19543
* trans-types.c (gfc_build_logical_type): #if 0 setting TYPE_PRECISION
to 1 to avoid wrong constant merging.
Index: trans-types.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-types.c,v
retrieving revision 1.36
diff -u -p -r1.36 trans-types.c
--- trans-types.c 16 Jan 2005 16:48:16 -0000 1.36
+++ trans-types.c 22 Jan 2005 00:48:18 -0000
@@ -420,7 +420,14 @@ gfc_build_logical_type (gfc_logical_info
new_type = make_unsigned_type (bit_size);
TREE_SET_CODE (new_type, BOOLEAN_TYPE);
TYPE_MAX_VALUE (new_type) = build_int_cst (new_type, 1);
+#if 0
+ /* FIXME: Unfortunately this breaks assumptions in the backend when
+ dealing with constants. More precisely,
+ LOGICAL(8), PARAMETER :: .TRUE.
+ will only be translated to a byte-sized constant in the
+ assembly. See PR 19543. */
TYPE_PRECISION (new_type) = 1;
+#endif
return new_type;
}
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: logical.f90
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050122/44283a43/attachment.f90>
More information about the Fortran
mailing list