Skip to content

Conversation

@erichkeane
Copy link
Contributor

For the checks we do in SemaSYCL via the callgraph, we don't want to
diagnose when it is in a discarded statement. This adds the
infrastructure for another bug, where we visit constexpr during this
too.

Note this is a 'draft' since I don't find myself with the time to implement the "rest" of this (tests + all the rest of the constexpr stuff). I believe @elizabethandrews was assigned the constexpr-call bug after @mibintc gave up on it ( :D), so this might be of interest to her!

The change to the CallGraph.cpp (CGBuilder) should be all that is necessary, we simply have to implement the 'visit' functions for every situation we can come up with for constant-evaluation. I believe the ill-planned ConstexprRAII (which likely needs removing once we fix this?) has at least most of the list implemented, so that should be at least a head start.

For the checks we do in SemaSYCL via the callgraph, we don't want to
diagnose when it is in a discarded statement. This adds the
infrastructure for another bug, where we visit constexpr during this
too.
}
}

VisitChildren(If);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line PERHAPS (i haven't thought enough through?) should be the StmtVisitor::VisitStmt(If); call instead... I think it ends up changing nothing, but is probably the right thing to do.

@erichkeane erichkeane closed this Jun 21, 2021
vladimirlaz pushed a commit that referenced this pull request Jun 23, 2021
This patch removes ConstexprDepthRAII which incorrectly maintained
constexpr context. Instead we don't traverse statements which are
forced constant expressions.

This patch fixes the following bugs -

constexpr int j = test_constexpr_context(recfn(1));
int k;
if constexpr (false)
k = recfn(1);
Here, recfn() is a recursive function. The usage 1. should not
diagnose in SYCL kernel since the function is called in constexpr
context. Similarly 2. should not diagnose in SYCL kernel since the
recursive function call is in a discarded branch.

Includes commits in PR - #3714


Signed-off-by: Elizabeth Andrews <[email protected]>
Co-authored-by: Erich Keane <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant