[cfe-commits] r168671 - /cfe/trunk/test/Analysis/malloc.c

Jordan Rose jordan_rose at apple.com
Mon Nov 26 18:37:49 PST 2012


Author: jrose
Date: Mon Nov 26 20:37:49 2012
New Revision: 168671

URL: http://llvm.org/viewvc/llvm-project?rev=168671&view=rev
Log:
[analyzer] Fix test to work on non-LP64 systems.

Thanks for the original catch in r168303, Takumi.

Modified:
    cfe/trunk/test/Analysis/malloc.c

Modified: cfe/trunk/test/Analysis/malloc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc.c?rev=168671&r1=168670&r2=168671&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc.c (original)
+++ cfe/trunk/test/Analysis/malloc.c Mon Nov 26 20:37:49 2012
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,debug.ExprInspection -analyzer-store=region -verify %s
-// REQUIRES: LP64
 
 #include "Inputs/system-header-simulator.h"
 
@@ -947,20 +946,24 @@
   pSt->memP = malloc(12);
 } // expected-warning{{Memory is never released; potential leak}}
 
+#ifdef __INTPTR_TYPE__
 // Test double assignment through integers.
-static long glob;
+typedef __INTPTR_TYPE__ intptr_t;
+typedef unsigned __INTPTR_TYPE__ uintptr_t;
+
+static intptr_t glob;
 void test_double_assign_ints()
 {
   void *ptr = malloc (16);  // no-warning
-  glob = (long)(unsigned long)ptr;
+  glob = (intptr_t)(uintptr_t)ptr;
 }
 
 void test_double_assign_ints_positive()
 {
   void *ptr = malloc(16);
-  (void*)(long)(unsigned long)ptr; // expected-warning {{unused}}
+  (void*)(intptr_t)(uintptr_t)ptr; // expected-warning {{unused}}
 } // expected-warning {{leak}}
-
+#endif
 
 void testCGContextNoLeak()
 {





More information about the cfe-commits mailing list