[llvm-commits] CVS: llvm/tools/lli/lli.cpp

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

Changes in directory llvm/tools/lli:

lli.cpp updated: 1.49 -> 1.50
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)

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

Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.49 llvm/tools/lli/lli.cpp:1.50
--- llvm/tools/lli/lli.cpp:1.49	Thu Apr 21 18:59:31 2005
+++ llvm/tools/lli/lli.cpp	Sat Oct 22 23:37:20 2005
@@ -96,7 +96,8 @@
     // If the program didn't explicitly call exit, call exit now, for the program.
     // This ensures that any atexit handlers get called correctly.
     Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
-                                                          Type::IntTy, 0);
+                                                          Type::IntTy,
+                                                          (Type *)0);
     std::vector<GenericValue> Args;
     GenericValue ResultGV;

More information about the llvm-commits mailing list