Index: gcc-4.3/gcc/fortran/match.c =================================================================== --- gcc-4.3/gcc/fortran/match.c (revision 120338) +++ gcc-4.3/gcc/fortran/match.c (working copy) @@ -396,6 +396,8 @@ gfc_match_name (char *buffer) c = gfc_next_char (); if (!ISALPHA (c)) { + if (gfc_error_flag_test() == 0) + gfc_error ("Invalid character in name at %C"); gfc_current_locus = old_loc; return MATCH_NO; } Index: gcc-4.3/gcc/testsuite/gfortran.dg/invalid_name.f90 =================================================================== --- gcc-4.3/gcc/testsuite/gfortran.dg/invalid_name.f90 (revision 0) +++ gcc-4.3/gcc/testsuite/gfortran.dg/invalid_name.f90 (revision 0) @@ -0,0 +1,6 @@ +! { dg-do compile } +! Tests the fix for PR27698, where names not starting with a letter were +! rejected but not diagnosed with a proper message. +SUBROUTINE _foo ! { dg-error "Invalid character in name" } +END + Index: gcc-4.3/gcc/testsuite/gfortran.dg/do_iterator.f90 =================================================================== --- gcc-4.3/gcc/testsuite/gfortran.dg/do_iterator.f90 (revision 120338) +++ gcc-4.3/gcc/testsuite/gfortran.dg/do_iterator.f90 (working copy) @@ -10,4 +10,4 @@ DO I=1,5 ! { dg-error "cannot be r READ(5,*,iostat=i) j ! { dg-error "cannot be redefined" "changing do-iterator 3" } ENDDO END - +! { dg-error "Invalid character" "character" { target *-*-* } 7 } Index: gcc-4.3/gcc/testsuite/gfortran.dg/gomp/pr29759.f90 =================================================================== --- gcc-4.3/gcc/testsuite/gfortran.dg/gomp/pr29759.f90 (revision 120338) +++ gcc-4.3/gcc/testsuite/gfortran.dg/gomp/pr29759.f90 (working copy) @@ -22,21 +22,21 @@ PROGRAM test_omp !$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" } -!$ NUM_THREADS(2) ! { dg-error "Unclassifiable" } +!$ NUM_THREADS(2) ! { dg-error "Unclassifiable|Invalid character" } !$OMP END PARALLEL ! { dg-error "Unexpected" } !$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" } -!$ & NUM_THREADS(2) ! { dg-error "Unclassifiable" } +!$ & NUM_THREADS(2) ! { dg-error "Unclassifiable|Invalid character" } !$OMP END PARALLEL ! { dg-error "Unexpected" } !$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" } ! -!$ NUM_THREADS(2) ! { dg-error "Unclassifiable" } +!$ NUM_THREADS(2) ! { dg-error "Unclassifiable|Invalid character" } !$OMP END PARALLEL ! { dg-error "Unexpected" } !$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" } ! -!$ & NUM_THREADS(2) ! { dg-error "Unclassifiable" } +!$ & NUM_THREADS(2) ! { dg-error "Unclassifiable|Invalid character" } !$OMP END PARALLEL ! { dg-error "Unexpected" } END PROGRAM