New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix remaining failures in expression semantics #871
Conversation
lib/semantics/expression.cc
Outdated
@@ -2279,10 +2273,12 @@ MaybeExpr ExpressionAnalyzer::ExprOrVariable(const PARSED &x) { | |||
} | |||
|
|||
MaybeExpr ExpressionAnalyzer::Analyze(const parser::Expr &expr) { | |||
auto save{GetContextualMessages().SetLocation(expr.source)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You renamed a similar save
variable to restorer
in AnalyzeCall
so I think that would be a better name here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do here & everywhere else in lib/.
@@ -78,12 +78,15 @@ class SubprogramDetails { | |||
const std::vector<Symbol *> &dummyArgs() const { return dummyArgs_; } | |||
void add_dummyArg(Symbol &symbol) { dummyArgs_.push_back(&symbol); } | |||
void add_alternateReturn() { dummyArgs_.push_back(nullptr); } | |||
const MaybeExpr &stmtFunction() const { return stmtFunction_; } | |||
void set_stmtFunction(SomeExpr &&expr) { stmtFunction_ = std::move(expr); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used for anything yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The CG will need it, though. And I suppose that folding could use it for statement functions in which each dummy argument appears at most once in the body (or whose actual argument can be safely re-evaluated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the presence of the statement function's expression is the only distinguishing characteristic by which semantics could determine that a subprogram is a statement function, and exclude it from use in various circumstances (e.g., passing the statement function as an actual argument, using the statement function in a generic interface, using the statement function as the target of a pointer assignment, &c.) which I'm sure that we still need to do.
… expressions Extend semantic analysis of expressions to catch missing cases Fix statement function semantics, add degree trig intrinsics Add GetUltimate to rewrite of bare namelist Address review comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good.
…fication expressions Extend semantic analysis of expressions to catch missing cases Fix statement function semantics, add degree trig intrinsics Add GetUltimate to rewrite of bare namelist Address review comments Original-commit: flang-compiler/f18@52ff319 Reviewed-on: flang-compiler/f18#871
…/pmk-fixes Fix remaining failures in expression semantics Original-commit: flang-compiler/f18@7473f0b Reviewed-on: flang-compiler/f18#871
…fication expressions Extend semantic analysis of expressions to catch missing cases Fix statement function semantics, add degree trig intrinsics Add GetUltimate to rewrite of bare namelist Address review comments Original-commit: flang-compiler/f18@52ff319 Reviewed-on: flang-compiler/f18#871
Apply implicit typing to names in COMMON that appear in specification expressions
Extend semantic analysis of expressions to catch missing cases
Fix statement function semantics, add degree trig intrinsics
Add GetUltimate to rewrite of bare namelist
Expression analysis must now succeed (barring previous fatal error) and will emit an internal error message when it fails that includes a dump of the expression's parse tree.