[PATCH] D35108: Fix crash parsing invalid code
Olivier Goffart via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 7 02:39:30 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL307371: Fix crash parsing invalid code (authored by ogoffart).
Changed prior to commit:
https://reviews.llvm.org/D35108?vs=105590&id=105604#toc
Repository:
rL LLVM
https://reviews.llvm.org/D35108
Files:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/address-packed.c
Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -12097,6 +12097,8 @@
if (ME->isArrow())
BaseType = BaseType->getPointeeType();
RecordDecl *RD = BaseType->getAs<RecordType>()->getDecl();
+ if (RD->isInvalidDecl())
+ return;
ValueDecl *MD = ME->getMemberDecl();
auto *FD = dyn_cast<FieldDecl>(MD);
Index: cfe/trunk/test/Sema/address-packed.c
===================================================================
--- cfe/trunk/test/Sema/address-packed.c
+++ cfe/trunk/test/Sema/address-packed.c
@@ -329,3 +329,12 @@
uint32_t *p32;
p32 = &a[0].x; // no-warning
}
+
+struct Invalid0 {
+ void *x;
+ struct fwd f; // expected-error {{incomplete type}} expected-note {{forward declaration}}
+} __attribute__((packed));
+
+void *g14(struct Invalid0 *ivl) {
+ return &(ivl->x);
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35108.105604.patch
Type: text/x-patch
Size: 962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170707/246ac047/attachment.bin>
More information about the cfe-commits
mailing list