[cfe-dev] Fix segfault on sizeof(incomplete type)
next_ghost at quick.cz
Sat Aug 9 14:06:07 PDT 2008
I've reported a segfault before in ASTRecordLayout::LayoutField().
There's a NULL pointer dereference if clang tries to calculate size of
struct which contains incomplete type (eg. another struct which is
declared but not defined). This patch should fix the problem and let
clang abort on the appropriate assert instead.
BTW, some of the asserts in ASTContext::getTypeInfo() could be turned
into simple compile errors because C99 forbids using sizeof operator on
When you apply this patch, you can close bug 2400. My problem will be
fixed and the problem reported by Mr. Lopes is invalid (size_t is
defined in <stddef.h> so its use in typedef on line 1 of the test case
is not allowed without #include <stddef.h>).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the cfe-dev