[Bug fortran/31203] Character length should never be negative
fxcoudert at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Mar 17 20:58:00 GMT 2007
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-03-17 20:58 -------
A two-lines fix for this bug:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 123028)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -227,6 +227,8 @@
gfc_init_se (&se, NULL);
gfc_conv_expr_type (&se, cl->length, gfc_charlen_type_node);
+ se.expr = fold_build2 (MAX_EXPR, gfc_charlen_type_node, se.expr,
+ build_int_cst (gfc_charlen_type_node, 0));
gfc_add_block_to_block (pblock, &se.pre);
tmp = cl->backend_decl;
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-03-16 20:48:08 |2007-03-17 20:58:19
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31203
More information about the Gcc-bugs
mailing list