diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index be7c8bf247f7af..50c34de51f254c 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -393,6 +393,9 @@ Bug Fixes in This Version operator in C. No longer issuing a confusing diagnostic along the lines of "incompatible operand types ('foo' and 'foo')" with extensions such as matrix types. Fixes (`#69008 `_) +- Fix a crash when evaluating comparison between the field from the same variable + which initialized from compound literals in C. Fixes + (`#69065 `_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index e5539dedec02a4..9948b516745a30 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -1912,7 +1912,6 @@ APValue &CallStackFrame::createLocal(APValue::LValueBase Base, const void *Key, assert(Base.getCallIndex() == Index && "lvalue for wrong frame"); unsigned Version = Base.getVersion(); APValue &Result = Temporaries[MapKeyTy(Key, Version)]; - assert(Result.isAbsent() && "local created multiple times"); // If we're creating a local immediately in the operand of a speculative // evaluation, don't register a cleanup to be run outside the speculative diff --git a/clang/test/AST/issue69065.c b/clang/test/AST/issue69065.c new file mode 100644 index 00000000000000..11428932019418 --- /dev/null +++ b/clang/test/AST/issue69065.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify +// expected-no-diagnostics + +struct A { + int i; +}; +struct B { + struct A *a; +}; +const struct B c = {&(struct A){1}}; + +int main(void) { + if ((c.a->i != 1) || (c.a->i)) { + return 1; + } + return 0; +}