summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-28 05:48:06 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-28 05:48:06 +0000
commite85cff84b910911354d51af41ffd1cc0cf0a8252 (patch)
tree26ed755dc9d36d2f15eca481497d060437631c00 /clang/lib/Sema/SemaChecking.cpp
parentb81dfa6378bc9b968fefeb37c1010d3401e0472b (diff)
downloadbcm5719-llvm-e85cff84b910911354d51af41ffd1cc0cf0a8252.tar.gz
bcm5719-llvm-e85cff84b910911354d51af41ffd1cc0cf0a8252.zip
Sema: Ensure that __c11_atomic_fetch_add has a pointer to complete type
Pointer arithmetic is only makes sense if the pointee type is complete. This fixes PR22361. llvm-svn: 227295
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index d1a27569dad..cfa61119c82 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -1404,6 +1404,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
<< IsC11 << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
+ if (IsC11 && ValType->isPointerType() &&
+ RequireCompleteType(Ptr->getLocStart(), ValType->getPointeeType(),
+ diag::err_incomplete_type)) {
+ return ExprError();
+ }
} else if (IsN && !ValType->isIntegerType() && !ValType->isPointerType()) {
// For __atomic_*_n operations, the value type must be a scalar integral or
// pointer type which is 1, 2, 4, 8 or 16 bytes in length.
OpenPOWER on IntegriCloud