[all-commits] [llvm/llvm-project] 77dc20: [flang] Detect circularly defined procedures

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Tue Feb 16 14:41:03 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77dc203cd0f65a8dbd71f3814e0cc3199c791980
      https://github.com/llvm/llvm-project/commit/77dc203cd0f65a8dbd71f3814e0cc3199c791980
  Author: Peter Steinfeld <psteinfeld at nvidia.com>
  Date:   2021-02-16 (Tue, 16 Feb 2021)

  Changed paths:
    M flang/include/flang/Evaluate/characteristics.h
    M flang/lib/Evaluate/characteristics.cpp
    A flang/test/Semantics/resolve102.f90

  Log Message:
  -----------
  [flang] Detect circularly defined procedures

It's possible to define a procedure that has a procedure dummy argument which
names the procedure that contains it.  This was causing the compiler to fall
into an infinite loop when characterizing a call to the procedure.

Following a suggestion from Peter, I fixed this be maintaining a set of
procedure symbols that had already been seen while characterizing a procedure.
This required passing a new parameter to the functions that characterized a
Procedure, a DummyArgument, and a DummyProcedure.

I also added several tests that will crash the compiler without this change.

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




More information about the All-commits mailing list