diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-01-28 19:18:37 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-01-28 19:18:37 +0000 |
commit | 3eedf3aeeb6677df482073037c44162c8dcd94e6 (patch) | |
tree | 7daf85f3411f0fee7ecee289c50ed61e3a2cd79d /lib | |
parent | 76d233c3472e061dbe64101040fde2e0e8644895 (diff) |
Merging r227295:
------------------------------------------------------------------------
r227295 | majnemer | 2015-01-27 21:48:06 -0800 (Tue, 27 Jan 2015) | 5 lines
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.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@227349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 9fc2bec23b..fdc136ccbd 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -1340,6 +1340,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. |