]> granicus.if.org Git - clang/commitdiff
From his comment in PR12168, Eli seems confused about the alignment assumptions
authorChris Lattner <sabre@nondot.org>
Sun, 4 Mar 2012 00:56:24 +0000 (00:56 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Mar 2012 00:56:24 +0000 (00:56 +0000)
we're making.  We only ignore implicit casts.  Add a testcase showing that
we get the right behavior with explicit casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151994 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/builtin-memfns.c

index e4389f6211421cbef9a026ab12aab30022823fab..72d340619f37904b96605bf7198cc32cb38c3243 100644 (file)
@@ -52,9 +52,13 @@ int test6(char *X) {
 // CHECK: @test7
 // PR12094
 int test7(int *p) {
+  struct snd_pcm_hw_params_t* hwparams;  // incomplete type.
+  
   // CHECK: call void @llvm.memset{{.*}}256, i32 4, i1 false)
   __builtin_memset(p, 0, 256);  // Should be alignment = 4
-  struct snd_pcm_hw_params_t* hwparams;  // incomplete type.
+
+  // CHECK: call void @llvm.memset{{.*}}256, i32 1, i1 false)
+  __builtin_memset((char*)p, 0, 256);  // Should be alignment = 1
 
   __builtin_memset(hwparams, 0, 256);  // No crash alignment = 1
   // CHECK: call void @llvm.memset{{.*}}256, i32 1, i1 false)