if (s == SAVE_EXPLICIT && gfc_pure (NULL))
{
- gfc_error
- ("SAVE attribute at %L cannot be specified in a PURE procedure",
- where);
+ gfc_error ("SAVE attribute at %L cannot be specified in a PURE "
+ "procedure", where);
return false;
}
if (s == SAVE_EXPLICIT && attr->save == SAVE_EXPLICIT
&& (flag_automatic || pedantic))
{
- if (!gfc_notify_std (GFC_STD_LEGACY,
- "Duplicate SAVE attribute specified at %L",
- where))
+ if (!where)
+ {
+ gfc_error ("Duplicate SAVE attribute specified near %C");
return false;
+ }
+
+ if (!gfc_notify_std (GFC_STD_LEGACY, "Duplicate SAVE attribute "
+ "specified at %L", where))
+ return false;
}
attr->save = s;
--- /dev/null
+! { dg-do compile }
+program p
+ procedure(g), save :: f ! { dg-error "PROCEDURE attribute conflicts" }
+ procedure(g), save :: f ! { dg-error "Duplicate SAVE attribute" }
+contains
+ subroutine g
+ end
+end