[all-commits] [llvm/llvm-project] cfd7d8: [flang] Fix bad dereference of NULLIFY pointer object

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Mon Mar 8 15:02:06 PST 2021


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

  Changed paths:
    M flang/lib/Semantics/check-nullify.cpp
    M flang/test/Semantics/nullify02.f90

  Log Message:
  -----------
  [flang] Fix bad dereference of NULLIFY pointer object

When we have a subprogram that has been determined to contain errors, we do not
perform name resolution on its execution part.  In this case, if the subprogram
contains a NULLIFY statement, the parser::Name of a pointer object in a NULLIFY
statement will not have had name resolution performed on it.  Thus, its symbol
will not have been set.  Later, however, we do semantic checking on the NULLIFY
statement.  The code that did this assumed that the parser::Name of the
pointer object was non-null.

I fixed this by just removing the null pointer check for the "symbol" member of
the "parser::Name" of the pointer object when doing semantic checking for
NULLIFY statements.  I also added a test that will make the compiler crash
without this change.

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




More information about the All-commits mailing list