[all-commits] [llvm/llvm-project] 48a826: [flang] Allow GOTO to containing END IF after ELSE

Peter Klausler via All-commits all-commits at lists.llvm.org
Tue Aug 29 10:14:56 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 48a8262cb8dce16b0e64cb1aec1d74dc96e5d551
      https://github.com/llvm/llvm-project/commit/48a8262cb8dce16b0e64cb1aec1d74dc96e5d551
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2023-08-29 (Tue, 29 Aug 2023)

  Changed paths:
    M flang/lib/Semantics/resolve-labels.cpp
    A flang/test/Semantics/label18.f90

  Log Message:
  -----------
  [flang] Allow GOTO to containing END IF after ELSE

Label resolution gets into an infinite loop trying to emit an inappropriate
error or warning for a GOTO whose target is on an enclosing END IF
statement with an intervening ELSE or ELSE IF.  The scope tracking mechanism
viewed the END IF as being part of the ELSE block's scope.

Fix with the same means that was used to fix a similar bogus error
on GOTOs to END SELECT in SELECT CASE blocks: nest the THEN/ELSE IF/ELSE
blocks one level deeper than before, so that the END IF is in the IF
block but not in any of its parts.

Fixes https://github.com/llvm/llvm-project/issues/64654 for
llvm-test-suite/Fortran/gfortran/regression/goto_5.f90.

Differential Revision: https://reviews.llvm.org/D159040




More information about the All-commits mailing list