[all-commits] [llvm/llvm-project] 40e261: [flang] Fix call to CHECK() on overriding an erron...

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Wed Mar 10 09:38:59 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 40e261803bd40099ee2f322670157b0b57d7bf3e
      https://github.com/llvm/llvm-project/commit/40e261803bd40099ee2f322670157b0b57d7bf3e
  Author: Peter Steinfeld <psteinfeld at nvidia.com>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M flang/lib/Semantics/check-declarations.cpp
    M flang/test/Semantics/bindings01.f90

  Log Message:
  -----------
  [flang] Fix call to CHECK() on overriding an erroneous type-bound procedure

You can define a base type with a type-bound procedure which is erroneously
missing a NOPASS attribute and then define another type that extends the base
type and overrides the erroneous procedure.  In this case, when we perform
semantic checking on the overriding procedure, we verify the "pass index" of
the overriding procedure.  The attempt to get the procedure's pass index fails
a call to CHECK().

I fixed this by calling SetError() on the symbol of the overridden procedure in
the base type.  Then, I check HasError() before executing the code that invokes
the failing call to CHECK().  I also added a test that will cause the compiler
to fail the call to CHECK() without this change.

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




More information about the All-commits mailing list