From http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/6ec0a526ea59aa94/
gfortran accepts in the three test cases in "1.", which violate C1232 (R1221) and C1233 (R1221). Fourth test case (should pass as dummy is pointer array, passes with gfortran) subroutine s10() implicit none interface subroutine sub10(dummy10) integer, volatile, dimension(:),pointer :: dummy10 end subroutine sub10 end interface integer, dimension(:), pointer :: a call sub10(a) end subroutine s10 "3." This is valid fortran and should be accepted. Patch for "3.": Index: gcc/fortran/symbol.c =================================================================== --- gcc/fortran/symbol.c (Revision 121011) +++ gcc/fortran/symbol.c (Arbeitskopie) @@ -877,8 +877,8 @@ gfc_add_volatile (symbol_attribute * attr, const char *name, locus * where) { - if (check_used (attr, name, where)) - return FAILURE; + /* No check_used needed as the volatile attribute is allowed for + use-associated entities. */ if (attr->volatile_) { Early draft for item "1.". The following does not work properly as array sections are not detected (first test case) and test case four is also rejected. *** gcc/fortran/interface.c (revision 121011) --- gcc/fortran/interface.c (working copy) *************** compare_actual_formal (gfc_actual_arglis *** 1417,1422 **** --- 1417,1449 ---- return 0; } + /* C1232 (R1221) For an actual argument which is a array sections or + an assumed-shaped array, the dummy argument shall be an assumed- + shaped array, if the dummy argument has the VOLATILE attribute. + C1233 (R1221) Similarly for actual pointer arrays: The VOLATILE + dummy argument shall be an assumed-shaped array or pointer array. */ + + if (((a->expr->symtree->n.sym->as + && a->expr->symtree->n.sym->as->type == AS_ASSUMED_SHAPE) + ||(a->expr->symtree->n.sym->as && a->expr->symtree->n.sym->as->type == AR_SECTION)) + && f->sym->attr.volatile_ + && !(f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE)) + { + if (where) + gfc_error ("Assumed-shaped or array-section actual argument at " + "%L is incompatible with the non-assumed-shaped " + "dummy argument '%s' due to VOLATILE attribute", + &a->expr->where,f->sym->name); + return 0; + } + -- Summary: Conflics checking of VOLATILE attribute needs improvement Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: rejects-valid, accepts-invalid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30520