https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77900
Bug ID: 77900 Summary: Compile time errors/warning for IO statements appear wrong Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jvdelisle at gcc dot gnu.org Target Milestone: --- While looking at something else I stumbled on this with iomesg_1.f90. $ gfc -std=gnu iomsg_1.f90 iomsg_1.f90:25:121: sg=ch) ! { dg-warning "STATUS specifier in CLOSE statement.*has invalid value" } 1 Warning: STATUS specifier in CLOSE statement at (1) has invalid value ‘no_idea’ I think the above should be a compile error no matter what. The line in questions is: close(23,status="no_idea", err=500, iomsg=ch) ! { dg-warning "STATUS specifier in CLOSE statement.*has invalid value" } It gives the expected error when changed to: close(23,status="no_idea") ! { dg-warning "STATUS specifier in CLOSE statement.*has invalid value" } Compile time errors vs warning should have nothing to do with the absence or presence of err= or iomsg= The wrong logic is in fortran/io.c. Probably other statements involved here.