+2010-05-19 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/38404
+ * primary.c (match_string_constant): Move start_locus just inside
+ the string.
+ * data.c (create_character_intializer): Clarified truncation warning.
+
2010-05-19 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34505
if (len > end - start)
{
+ gfc_warning_now ("Initialization string starting at %L was "
+ "truncated to fit the variable (%d/%d)",
+ &rvalue->where, end - start, len);
len = end - start;
- gfc_warning_now ("initialization string truncated to match variable "
- "at %L", &rvalue->where);
}
if (rvalue->ts.type == BT_HOLLERITH)
gfc_gobble_whitespace ();
- start_locus = gfc_current_locus;
-
c = gfc_next_char ();
if (c == '\'' || c == '"')
{
kind = gfc_default_character_kind;
+ start_locus = gfc_current_locus;
goto got_delim;
}
goto no_match;
gfc_gobble_whitespace ();
- start_locus = gfc_current_locus;
c = gfc_next_char ();
if (c != '\'' && c != '"')
goto no_match;
+ start_locus = gfc_current_locus;
+
if (kind == -1)
{
q = gfc_extract_int (sym->value, &kind);
e->ts.is_iso_c = 0;
gfc_current_locus = start_locus;
- gfc_next_char (); /* Skip delimiter */
/* We disable the warning for the following loop as the warning has already
been printed in the loop above. */
+2010-05-19 Daniel Franke <franke.daniel@gmail.com>
+
+ PR fortran/38404
+ * gfortran.dg/data_char_1.f90: Updated warning message.
+ * gfortran.dg/data_array_6.f: New.
+
2010-05-19 Martin Jambor <mjambor@suse.cz>
* g++.dg/ipa/ivinline-8.C: New test.
--- /dev/null
+! { dg-do "compile" }
+!
+! PR fortran/38404 - location marker in wrong line
+! Testcase contributed by Steve Chapel <steve DOT chapel AT a2pg DOT com>
+!
+
+ CHARACTER(len=72) TEXT(3)
+ DATA (TEXT(I),I=1,3)/
+ &'a string without issues',
+ &'a string with too many characters properly broken into the next
+ &line but too long to fit the variable',
+ & '
+ &a string that started just at the end of the last line -- some
+ &may not be helped'/
+
+ ! { dg-warning "truncated" "" { target *-*-* } 10 }
+ ! { dg-warning "truncated" "" { target *-*-* } 12 }
+
+ END
program data_char_1
character(len=5) :: a(2)
character(len=5) :: b(2)
- data a /'Hellow', 'orld'/ ! { dg-warning "string truncated" }
+ data a /'Hellow', 'orld'/ ! { dg-warning "truncated" }
data b(:)(1:4), b(1)(5:5), b(2)(5:5) &
- /'abcdefg', 'hi', 'j', 'k'/ ! { dg-warning "string truncated" }
+ /'abcdefg', 'hi', 'j', 'k'/ ! { dg-warning "truncated" }
if ((a(1) .ne. 'Hello') .or. (a(2) .ne. 'orld ')) call abort
if ((b(1) .ne. 'abcdj') .or. (b(2) .ne. 'hi k')) call abort