[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp

Jeff Cohen jeffc at jolt-lang.org
Sat Oct 22 21:37:37 PDT 2005



Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.34 -> 1.35
---
Log message:

When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.


---
Diffs of the changes:  (+2 -1)

 IntrinsicLowering.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.34 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.35
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.34	Wed Jul 27 01:12:33 2005
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp	Sat Oct 22 23:37:20 2005
@@ -110,7 +110,8 @@
       case Intrinsic::memset:
         M.getOrInsertFunction("memset", PointerType::get(Type::SByteTy),
                               PointerType::get(Type::SByteTy),
-                              Type::IntTy, (--(--I->arg_end()))->getType(), 0);
+                              Type::IntTy, (--(--I->arg_end()))->getType(),
+                              (Type *)0);
         break;
       case Intrinsic::isunordered:
         EnsureFunctionExists(M, "isunordered", I->arg_begin(), I->arg_end(),






More information about the llvm-commits mailing list