In gfc_match_allocate one finds a call to gfc_resolve_expr, which resolves the optional SOURCE expression.
By definition, resolving should be done at resolution stage, and not already when matching the ALLOCATE statement. The canonical way to do it would be to add something like 'gfc_resolve_expr (code->expr3)' in resolve_code, where already code->expr1 and code->expr2 are being resolved (the SOURCE expr is being stored in code->expr3). So, unless there are very good reasons for the resolution to happen in gfc_match_allocate, the call to gfc_resolve_expr should be moved to resolve.c (together with the various checks for the SOURCE expression that follow it). I think the questionable code was committed as part of r151023 by Steve, when he implemented the SOURCE tag in ALLOCATE statements. -- Summary: [Cleanup] Don't resolve expr in gfc_match_allocate Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: janus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41758