[flang-commits] [PATCH] D101001: [flang] Fix spurious errors from runtime derived type table construction

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Apr 21 15:13:53 PDT 2021


klausler created this revision.
klausler added reviewers: PeteSteinfeld, awarzynski.
klausler added a project: Flang.
Herald added subscribers: jdoerfert, kristof.beyls.
klausler requested review of this revision.

Andrezj W. @ Arm discovered that the runtime derived type table
building code in semantics was detecting fatal errors in the tests
that the f18 driver wasn't printing.  This patch fixes f18 so that
these messages are printed; however, the messages were not valid user
errors, and the rest of this patch fixes them up.

There were two sources of the bogus errors.  One was that the runtime
derived type information table builder was calculating the shapes of
allocatable and pointer array components in derived types, and then
complaining that they weren't constant or LEN parameter values, which
of course they couldn't be since they have to have deferred shapes
and those bounds were expressions like LBOUND(component,dim=1).

The second was that f18 was forwarding the actual LEN type parameter
expressions of a type instantiation too far into the uses of those
parameters in various expressions in the declarations of components;
when an actual LEN type parameter is not a constant value, it needs
to remain a "bare" type parameter inquiry so that it will be lowered
to a descriptor inquiry and acquire a captured expression value.

Fixing this up properly involved: moving some code into new utility
function templates in Evaluate/tools.h, tweaking the rewriting of
conversions in expression folding to elide needless integer kind
conversions of type parameter inquiries, making type parameter
inquiry folding *not* replace bare LEN type parameters with
non-constant actual parameter values, and cleaning up some
altered test results.


https://reviews.llvm.org/D101001

Files:
  flang/include/flang/Evaluate/tools.h
  flang/lib/Evaluate/fold-implementation.h
  flang/lib/Evaluate/fold-integer.cpp
  flang/lib/Semantics/runtime-type-info.cpp
  flang/lib/Semantics/type.cpp
  flang/test/Semantics/modfile22.f90
  flang/test/Semantics/typeinfo01.f90
  flang/tools/f18/f18.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101001.339404.patch
Type: text/x-patch
Size: 13792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210421/9ac77502/attachment-0001.bin>


More information about the flang-commits mailing list