https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60144
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- I don't understand the goal of the block (line 1651 of gcc/fortran/match.c) /* The gfc_match_assignment() above may have returned a MATCH_NO where the assignment was to a named constant. Check that special case here. */ m = gfc_match_assignment (); if (m == MATCH_NO) { gfc_error ("Cannot assign to a named constant at %C"); gfc_free_expr (expr); gfc_undo_symbols (); gfc_current_locus = old_loc; return MATCH_ERROR; } The closest test matching my understanding of the comment is integer, parameter :: i = 1 if (i == 2) i = 3 ! { dg-error "in variable definition context" } end which gives the following error if_param.f90:2:12: 2 | if (i == 2) i = 3 ! { dg-error "in variable definition context" } | 1 Error: Named constant 'i' in variable definition context (assignment) at (1) If I remove the block, I get the following errors for the test in comment 0: pr60144.f90:2:15: 2 | if (.TRUE.) | 1 Error: Unclassifiable statement in IF-clause at (1) pr60144.f90:3:11: 3 | else if (.FALSE.) | 1 Error: Unexpected junk after ELSE statement at (1) which looks better for the IF statement. For the ELSE IF error, how can I move the caret after '(.FALSE.)' and replace 'junk' with something neutral (token, statement, ...)?