http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57035
Bug #: 57035 Summary: TS29113's C535b: Wrongly accept DIMENSION(..) to TRANSFER Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org >From http://gcc.gnu.org/ml/fortran/2013-04/msg00203.html The following code is wrongly accepted: subroutine assumed_rank (a) integer, intent(in) :: a(..) integer :: c(1:4) c = transfer(a,c,4) end subroutine >From TS29113: "C535b An assumed-rank variable name shall not appear in a designator or expression except as an actual argument corresponding to a dummy argument that is assumed-rank, the argument of the C_LOC function in the ISO_C_BINDING intrinsic module, or the first argument in a reference to an intrinsic inquiry function." There might be similar issues with TYPE(*) and !GCC$ attributes no_arg_check, which are similar constraints. Possibly the simplest would be to use intrinsic.c's do_check which could use both if (!specific->inquiry) ... and for (arg = arg->next; arg; arg = arg->next) if (arg->expr ... ) ...