Message ID | 1283679909.1254.8.camel@linux-fd1f.site |
---|---|
State | New |
Headers | show |
Am Sonntag, den 05.09.2010, 11:45 +0200 schrieb Thomas Koenig: > Hello world, > > the attached patch fixes PR 34145, where we failed to detect that a > string was in fact a single character. ping**0.25? Thomas
Le 06.09.2010 21:04, Thomas Koenig a écrit : > > Am Sonntag, den 05.09.2010, 11:45 +0200 schrieb Thomas Koenig: >> Hello world, >> >> the attached patch fixes PR 34145, where we failed to detect that a >> string was in fact a single character. > > > ping**0.25? > > Thomas > > I OKed it already, but it seems that I forgot to CC the mailing lists. OK again. Mikael.
Hello Mikael, > Le 06.09.2010 21:04, Thomas Koenig a écrit : > > > > Am Sonntag, den 05.09.2010, 11:45 +0200 schrieb Thomas Koenig: > >> Hello world, > >> > >> the attached patch fixes PR 34145, where we failed to detect that a > >> string was in fact a single character. > > > > > > ping**0.25? > > > > Thomas > > > > > I OKed it already, but it seems that I forgot to CC the mailing lists. > OK again. Sende fortran/ChangeLog Sende fortran/trans-expr.c Sende testsuite/ChangeLog Hinzufügen testsuite/gfortran.dg/char_length_17.f90 Übertrage Daten .... Revision 163932 übertragen. Thanks a lot! It seems I missed your original OK in my inbox. I'm looking at your transpose patch right now, which survived the testing I gave it so far. Thomas
Index: trans-expr.c =================================================================== --- trans-expr.c (Revision 163868) +++ trans-expr.c (Arbeitskopie) @@ -463,12 +463,20 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, in gfc_free (msg); } - tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_charlen_type_node, - end.expr, start.expr); - tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_charlen_type_node, - build_int_cst (gfc_charlen_type_node, 1), tmp); - tmp = fold_build2_loc (input_location, MAX_EXPR, gfc_charlen_type_node, tmp, - build_int_cst (gfc_charlen_type_node, 0)); + /* If the start and end expressions are equal, the length is one. */ + if (ref->u.ss.end + && gfc_dep_compare_expr (ref->u.ss.start, ref->u.ss.end) == 0) + tmp = build_int_cst (gfc_charlen_type_node, 1); + else + { + tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_charlen_type_node, + end.expr, start.expr); + tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_charlen_type_node, + build_int_cst (gfc_charlen_type_node, 1), tmp); + tmp = fold_build2_loc (input_location, MAX_EXPR, gfc_charlen_type_node, + tmp, build_int_cst (gfc_charlen_type_node, 0)); + } + se->string_length = tmp; }