[all-commits] [llvm/llvm-project] 4d8c00: [flang] Fix crash on erroneous expressions
Pete Steinfeld via All-commits
all-commits at lists.llvm.org
Fri Jun 5 08:47:14 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 4d8c00c0595b6998e41373afadaaca3f51ae2cf8
https://github.com/llvm/llvm-project/commit/4d8c00c0595b6998e41373afadaaca3f51ae2cf8
Author: Pete Steinfeld <psteinfeld at nvidia.com>
Date: 2020-06-05 (Fri, 05 Jun 2020)
Changed paths:
M flang/lib/Semantics/check-do-forall.cpp
M flang/lib/Semantics/check-do-forall.h
M flang/test/Semantics/resolve91.f90
Log Message:
-----------
[flang] Fix crash on erroneous expressions
Summary:
If you create an expression with parse errors, the `parser::Expr.typedExpr`
will be empty, which causes a compiler crash. The crash is caused by the
check in check-do-forall.cpp that scans all expresssions to see if `DO`
variables are being modified.
It turned out that the problem was that I was fetching subexpressions of type
`parser::Expr`, which are not guaranteed to have a non-null `typedExpr`. I
fixed this by only grabbing the top-level expression from which to gather
arguments as part of the DO loop analysis. This, in turn, exposed a problem
where I wasn't collecting all of the actual arguments in an expression. This
was caused by the fact that I wasn't recursing through the rest of the
expression after finding an argument. I fixed this by recursing through the
argument in the member function in `CollectActualArgumentsHelper`.
Reviewers: klausler, tskeith, DavidTruby
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81101
More information about the All-commits
mailing list