[llvm-commits] CVS: llvm/lib/Debugger/UnixLocalInferiorProcess.cpp

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

Changes in directory llvm/lib/Debugger:

UnixLocalInferiorProcess.cpp updated: 1.8 -> 1.9
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)

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

Index: llvm/lib/Debugger/UnixLocalInferiorProcess.cpp
diff -u llvm/lib/Debugger/UnixLocalInferiorProcess.cpp:1.8 llvm/lib/Debugger/UnixLocalInferiorProcess.cpp:1.9
--- llvm/lib/Debugger/UnixLocalInferiorProcess.cpp:1.8	Thu Apr 21 17:36:21 2005
+++ llvm/lib/Debugger/UnixLocalInferiorProcess.cpp	Sat Oct 22 23:37:20 2005
@@ -924,7 +924,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 = M->getOrInsertFunction("exit", Type::VoidTy, Type::IntTy, 0);
+  Function *Exit = M->getOrInsertFunction("exit", Type::VoidTy, Type::IntTy,
+                                          (Type *)0);
   std::vector<GenericValue> Args;
   GenericValue ResultGV;

More information about the llvm-commits mailing list