aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.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/decl.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/decl.c')
-rw-r--r--gcc/fortran/decl.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 5f12fe1..d5c8c33 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -99,6 +99,11 @@ bool gfc_matching_function;
/* Set upon parsing a !GCC$ unroll n directive for use in the next loop. */
int directive_unroll = -1;
+/* Set upon parsing supported !GCC$ pragmas for use in the next loop. */
+bool directive_ivdep = false;
+bool directive_vector = false;
+bool directive_novector = false;
+
/* Map of middle-end built-ins that should be vectorized. */
hash_map<nofree_string_hash, int> *gfc_vectorized_builtins;
@@ -11528,3 +11533,53 @@ gfc_match_gcc_builtin (void)
return MATCH_YES;
}
+
+/* Match an !GCC$ IVDEP statement.
+ When we come here, we have already matched the !GCC$ IVDEP string. */
+
+match
+gfc_match_gcc_ivdep (void)
+{
+ if (gfc_match_eos () == MATCH_YES)
+ {
+ directive_ivdep = true;
+ return MATCH_YES;
+ }
+
+ gfc_error ("Syntax error in !GCC$ IVDEP directive at %C");
+ return MATCH_ERROR;
+}
+
+/* Match an !GCC$ VECTOR statement.
+ When we come here, we have already matched the !GCC$ VECTOR string. */
+
+match
+gfc_match_gcc_vector (void)
+{
+ if (gfc_match_eos () == MATCH_YES)
+ {
+ directive_vector = true;
+ directive_novector = false;
+ return MATCH_YES;
+ }
+
+ gfc_error ("Syntax error in !GCC$ VECTOR directive at %C");
+ return MATCH_ERROR;
+}
+
+/* Match an !GCC$ NOVECTOR statement.
+ When we come here, we have already matched the !GCC$ NOVECTOR string. */
+
+match
+gfc_match_gcc_novector (void)
+{
+ if (gfc_match_eos () == MATCH_YES)
+ {
+ directive_novector = true;
+ directive_vector = false;
+ return MATCH_YES;
+ }
+
+ gfc_error ("Syntax error in !GCC$ NOVECTOR directive at %C");
+ return MATCH_ERROR;
+}