aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDaniel Franke <franke.daniel@gmail.com>2010-05-19 08:55:26 -0400
committerDaniel Franke <dfranke@gcc.gnu.org>2010-05-19 08:55:26 -0400
commit66faed764371fe6385d54d6e7dc0a9cb0fa5c67f (patch)
treed49ae3e63ba3e59b31cb9720298cce5bd6cf56f9 /gcc
parent749aa96dabbb0fef0d81b382a49849186f907d95 (diff)
downloadgcc-66faed764371fe6385d54d6e7dc0a9cb0fa5c67f.zip
gcc-66faed764371fe6385d54d6e7dc0a9cb0fa5c67f.tar.gz
gcc-66faed764371fe6385d54d6e7dc0a9cb0fa5c67f.tar.bz2
re PR fortran/38404 (Warning message identifies incorrect line)
gcc/fortran/: 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. gcc/testsuite/: 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. From-SVN: r159561
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/data.c5
-rw-r--r--gcc/fortran/primary.c7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/data_array_6.f19
-rw-r--r--gcc/testsuite/gfortran.dg/data_char_1.f904
6 files changed, 40 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 09d758a..b9a986e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,12 @@
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
* intrinsic.h (gfc_check_float): New prototype.
(gfc_check_sngl): New prototype.
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index c217e1c..6561cdc 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -154,9 +154,10 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts,
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)
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index c8ca3d4..09f4eb1 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -868,12 +868,11 @@ match_string_constant (gfc_expr **result)
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;
}
@@ -917,12 +916,13 @@ match_string_constant (gfc_expr **result)
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);
@@ -976,7 +976,6 @@ got_delim:
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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 237b3c1..f18f56f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+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.
diff --git a/gcc/testsuite/gfortran.dg/data_array_6.f b/gcc/testsuite/gfortran.dg/data_array_6.f
new file mode 100644
index 0000000..6564402
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/data_array_6.f
@@ -0,0 +1,19 @@
+! { 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
diff --git a/gcc/testsuite/gfortran.dg/data_char_1.f90 b/gcc/testsuite/gfortran.dg/data_char_1.f90
index 00381c6..96db4fd 100644
--- a/gcc/testsuite/gfortran.dg/data_char_1.f90
+++ b/gcc/testsuite/gfortran.dg/data_char_1.f90
@@ -5,9 +5,9 @@
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