aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2019-08-27 19:16:33 +0000
committerHarald Anlauf <anlauf@gcc.gnu.org>2019-08-27 19:16:33 +0000
commit2bd86b95f76315f102c52a81453ef375c97e8f1b (patch)
treeb7b05454a14ad73627667f20119d26edd65542b7 /gcc/fortran/parse.c
parent340d34bf76dd9455ab07ea849168bf2503d5edef (diff)
downloadgcc-2bd86b95f76315f102c52a81453ef375c97e8f1b.zip
gcc-2bd86b95f76315f102c52a81453ef375c97e8f1b.tar.gz
gcc-2bd86b95f76315f102c52a81453ef375c97e8f1b.tar.bz2
re PR fortran/91496 (!GCC$ directives error if mistyped or unknown)
2019-08-27 Harald Anlauf <anlauf@gmx.de> PR fortran/91496 * gfortran.h: Extend struct gfc_iterator for loop annotations. * array.c (gfc_copy_iterator): Copy loop annotations by IVDEP, VECTOR, and NOVECTOR pragmas. * decl.c (gfc_match_gcc_ivdep, gfc_match_gcc_vector) (gfc_match_gcc_novector): New matcher functions handling IVDEP, VECTOR, and NOVECTOR pragmas. * match.h: Declare prototypes of matcher functions handling IVDEP, VECTOR, and NOVECTOR pragmas. * parse.c (decode_gcc_attribute, parse_do_block) (parse_executable): Decode IVDEP, VECTOR, and NOVECTOR pragmas; emit warning for unrecognized pragmas instead of error. * trans-stmt.c (gfc_trans_simple_do, gfc_trans_do): Add code to emit annotations for IVDEP, VECTOR, and NOVECTOR pragmas. * gfortran.texi: Document IVDEP, VECTOR, and NOVECTOR pragmas. PR fortran/91496 * gfortran.dg/pr91496.f90: New testcase. From-SVN: r274966
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 31466d2..8950b6a 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -1079,12 +1079,20 @@ decode_gcc_attribute (void)
match ("attributes", gfc_match_gcc_attributes, ST_ATTR_DECL);
match ("unroll", gfc_match_gcc_unroll, ST_NONE);
match ("builtin", gfc_match_gcc_builtin, ST_NONE);
+ match ("ivdep", gfc_match_gcc_ivdep, ST_NONE);
+ match ("vector", gfc_match_gcc_vector, ST_NONE);
+ match ("novector", gfc_match_gcc_novector, ST_NONE);
/* All else has failed, so give up. See if any of the matchers has
stored an error message of some sort. */
if (!gfc_error_check ())
- gfc_error_now ("Unclassifiable GCC directive at %C");
+ {
+ if (pedantic)
+ gfc_error_now ("Unclassifiable GCC directive at %C");
+ else
+ gfc_warning_now (0, "Unclassifiable GCC directive at %C, ignored");
+ }
reject_statement ();
@@ -4672,6 +4680,21 @@ parse_do_block (void)
new_st.ext.iterator->unroll = directive_unroll;
directive_unroll = -1;
}
+ if (directive_ivdep)
+ {
+ new_st.ext.iterator->ivdep = directive_ivdep;
+ directive_ivdep = false;
+ }
+ if (directive_vector)
+ {
+ new_st.ext.iterator->vector = directive_vector;
+ directive_vector = false;
+ }
+ if (directive_novector)
+ {
+ new_st.ext.iterator->novector = directive_novector;
+ directive_novector = false;
+ }
}
else
stree = NULL;
@@ -5433,6 +5456,15 @@ parse_executable (gfc_statement st)
if (directive_unroll != -1)
gfc_error ("%<GCC unroll%> directive does not commence a loop at %C");
+ if (directive_ivdep)
+ gfc_error ("%<GCC ivdep%> directive does not commence a loop at %C");
+
+ if (directive_vector)
+ gfc_error ("%<GCC vector%> directive does not commence a loop at %C");
+
+ if (directive_novector)
+ gfc_error ("%<GCC novector%> directive does not commence a loop at %C");
+
st = next_statement ();
}
}