aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 46e1e1b..3671513 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -639,20 +639,10 @@ decode_oacc_directive (void)
gfc_matching_function = false;
- if (gfc_pure (NULL))
- {
- gfc_error_now ("OpenACC directives at %C may not appear in PURE "
- "procedures");
- gfc_error_recovery ();
- return ST_NONE;
- }
-
if (gfc_current_state () == COMP_FUNCTION
&& gfc_current_block ()->result->ts.kind == -1)
spec_only = true;
- gfc_unset_implicit_pure (NULL);
-
old_locus = gfc_current_locus;
/* General OpenACC directive matching: Instead of testing every possible
@@ -663,6 +653,21 @@ decode_oacc_directive (void)
switch (c)
{
+ case 'r':
+ matcha ("routine", gfc_match_oacc_routine, ST_OACC_ROUTINE);
+ break;
+ }
+
+ gfc_unset_implicit_pure (NULL);
+ if (gfc_pure (NULL))
+ {
+ gfc_error_now ("OpenACC directives other than ROUTINE may not appear in PURE "
+ "procedures at %C");
+ goto error_handling;
+ }
+
+ switch (c)
+ {
case 'a':
matcha ("atomic", gfc_match_oacc_atomic, ST_OACC_ATOMIC);
break;
@@ -705,9 +710,6 @@ decode_oacc_directive (void)
case 'l':
matcha ("loop", gfc_match_oacc_loop, ST_OACC_LOOP);
break;
- case 'r':
- match ("routine", gfc_match_oacc_routine, ST_OACC_ROUTINE);
- break;
case 's':
matcha ("serial loop", gfc_match_oacc_serial_loop, ST_OACC_SERIAL_LOOP);
matcha ("serial", gfc_match_oacc_serial, ST_OACC_SERIAL);