-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[clang][bytecode] Handle discarded AddrLabelExprs properly #165000
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
Conversation
emitDummyPtr() doesn't like to be called with DiscardResult set, so check this first. Fixes llvm#164979
|
@llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) ChangesemitDummyPtr() doesn't like to be called with DiscardResult set, so check this first. Fixes #164979 Full diff: https://github.com/llvm/llvm-project/pull/165000.diff 2 Files Affected:
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 836d22f6e5389..9d73c1ecfacdd 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -3942,6 +3942,8 @@ bool Compiler<Emitter>::VisitRecoveryExpr(const RecoveryExpr *E) {
template <class Emitter>
bool Compiler<Emitter>::VisitAddrLabelExpr(const AddrLabelExpr *E) {
assert(E->getType()->isVoidPointerType());
+ if (DiscardResult)
+ return true;
return this->emitDummyPtr(E, E);
}
diff --git a/clang/test/AST/ByteCode/cxx11.cpp b/clang/test/AST/ByteCode/cxx11.cpp
index 8efd3201d6200..427d3a106656b 100644
--- a/clang/test/AST/ByteCode/cxx11.cpp
+++ b/clang/test/AST/ByteCode/cxx11.cpp
@@ -370,3 +370,12 @@ namespace GH150709 {
static_assert((e2[0].*mp)() == 1, ""); // ref-error {{constant expression}}
static_assert((g.*mp)() == 1, ""); // ref-error {{constant expression}}
}
+
+namespace DiscardedAddrLabel {
+ void foo(void) {
+ L:
+ *&&L; // both-error {{indirection not permitted}} \
+ // both-warning {{expression result unused}}
+ }
+}
+
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/21321 Here is the relevant piece of the build log for the reference |
emitDummyPtr() doesn't like to be called with DiscardResult set, so check this first. Fixes llvm#164979
emitDummyPtr() doesn't like to be called with DiscardResult set, so check this first. Fixes llvm#164979
emitDummyPtr() doesn't like to be called with DiscardResult set, so check this first. Fixes llvm#164979
emitDummyPtr() doesn't like to be called with DiscardResult set, so check this first.
Fixes #164979