[PATCH] D83917: [flang] Fix a crash when a BOZ literal is used as a relational operator
Pete Steinfeld via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 16:04:27 PDT 2020
PeteSteinfeld created this revision.
PeteSteinfeld added a reviewer: tskeith.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Expressions like `iVar==z'fe'` were causing a crash because the `Relate()`
function in `Evaluate/tools.cpp` that processes relational operators didn't
deal with BOZ literals, which are typeless. I fixed this by checking to see if
the operands are BOZ literals. If so, I convert them to integers with default
kind. To get the default kind, I needed to pass a new parameter to `Relate()`.
I also added a test to resolve63.f90 that triggers the problem.
Also, when I ran the latest `clang-format` on `Evaluate/tools.cpp`, it
reformatted a comment which was coincidentally related to BOZ literals. This
change is unrelated to the rest of the code.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83917
Files:
flang/include/flang/Evaluate/tools.h
flang/lib/Evaluate/tools.cpp
flang/lib/Semantics/expression.cpp
flang/test/Semantics/resolve63.f90
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83917.278333.patch
Type: text/x-patch
Size: 12559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/2ba06762/attachment.bin>
More information about the llvm-commits
mailing list