aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/builtins.c
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-07-18 07:23:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-07-18 07:23:17 +0000
commitdb4325b098eff5e9e660db19f0148423fb21f27f (patch)
tree8fa64475dc2ac61a9f03b0367bbc68d14533ac46 /test/Sema/builtins.c
parent9638eef7e3b2ca30406c5d369a44aa49ff26b201 (diff)
Improve the representation of the atomic builtins in a few ways. First, we make
their call expressions synthetically have the "deduced" types based on their first argument. We only insert conversions in the AST for arguments whose values require conversion to match the value type expected. This keeps PR7600 closed by maintaining the return type, but avoids assertions due to unexpected implicit casts making the type unsigned (test case added from Daniel). The magic is moved into the codegen for the atomic builtin which inserts the casts as needed at the IR level to raise the type to an integer suitable for the LLVM intrinsic. This shouldn't cause any real change in functionality, but now we can make the builtin be more truly polymorphic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/builtins.c')
-rw-r--r--test/Sema/builtins.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index c0a2131868..64a4b30492 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -44,6 +44,11 @@ void test9(short v) {
// PR7600: Pointers are implicitly casted to integers and back.
void *old_ptr = __sync_val_compare_and_swap((void**)0, 0, 0);
+
+ // Ensure the return type is correct even when implicit casts are stripped
+ // away. This triggers an assertion while checking the comparison otherwise.
+ if (__sync_fetch_and_add(&old, 1) == 1) {
+ }
}