[all-commits] [llvm/llvm-project] cdbfb4: [flang] Fix bug for forward referenced type

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Mon Sep 14 15:24:06 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cdbfb47998cd37ab0384ad944fa8e4ba1e1b47d0
      https://github.com/llvm/llvm-project/commit/cdbfb47998cd37ab0384ad944fa8e4ba1e1b47d0
  Author: Peter Steinfeld <psteinfeld at nvidia.com>
  Date:   2020-09-14 (Mon, 14 Sep 2020)

  Changed paths:
    M flang/lib/Semantics/expression.cpp
    M flang/test/Semantics/bad-forward-type.f90

  Log Message:
  -----------
  [flang] Fix bug for forward referenced type

A type name in an IMPLICIT declaration that was later used in a PARAMETER
statement caused problems because the default symbol scope had not yet been
initialized.  I avoided dereferencing in the situation where the default scope
was uninitialized and added a test that triggers the problem.

Also, once I corrected the bad dereference, the compiler was putting out
misleading error messages.  The underlying error us due to violating section
7.5.10, paragraph 4, which states:
  A structure constructor shall not appear before the referenced type is
  defined.

I fixed this by testing to see if a type that is used in a structure
constructor is forward referenced.

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




More information about the All-commits mailing list