[PATCH] D98225: [flang] Sort symbols by creation order

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 8 17:18:07 PST 2021


PeteSteinfeld created this revision.
PeteSteinfeld added reviewers: klausler, tskeith.
PeteSteinfeld requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We have a "<" operator defined on the type semantics::Symbol that's based on
the symbols' locations in the cooked character stream.  This is potentially
problematic when comparing symbols from .mod files when the cooked character
streams themselves might be allocated to varying memory locations.

This change fixes that by using the order in which symbols are created as the
basis for the "<" operator.  Thanks to Tim and Peter for consultation on the
necessity of doing this and the idea for what to use as the basis of the sort.

This change in the "<" operator changed the expected results for three of the
tests.  I manually inspected the new results, and they look OK to me.  The
differences in data05.f90 and typeinfo01.f90 are entirely the order, offsets,
and sizes of the derived type components.  The changes in resolve102.f90 are
due to the new, different "<" operator used for sorting.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98225

Files:
  flang/include/flang/Semantics/symbol.h
  flang/lib/Semantics/symbol.cpp
  flang/test/Semantics/data05.f90
  flang/test/Semantics/resolve102.f90
  flang/test/Semantics/typeinfo01.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98225.329169.patch
Type: text/x-patch
Size: 9808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210309/efba117a/attachment.bin>


More information about the llvm-commits mailing list