# New Ticket Created by  Jarkko Hietaniemi 
# Please include the string:  [perl #41110]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41110 >




-------- Original Message --------
Subject: [PATCH] tru64: compile (src/nci.c) and runtime (src/memory.c)
Date: Sun, 03 Dec 2006 16:54:03 -0500
From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Perl6 Internals List <perl6-internals@perl.org>

Two patches, the first is needed for parrot trunk to compile at all
in Tru64, the second one is needed to dodge dozens of core dumps.
There still are some, will take a closer look when I have more time,
but least this way there is less wading in core dumps.

In more detail:

The first one is required because otherwise the strange 0xc4 in the
string constant makes the tru64 compiler quite unhappy.  (I haven't
looked in detail but I think that without extra flags the tru64 compiler
allows only pure ASCII in string constants).

The second one: in tru64 malloc/calloc/realloc of zero bytes returns
a NULL ptr (quite logical, in a way: you couldn't put anything in a
memory block of zero bytes...).  I guess one could be fancier and
add a probe for this feature in Configure.pl, but I was feeling lazy.


--- tools/build/nativecall.pl.dist      2006-12-03 22:52:46.000000000 +0200
+++ tools/build/nativecall.pl   2006-12-03 22:53:01.000000000 +0200
@@ -678,7 +678,7 @@
     iglobals = interp->iglobals;
 
     if (PMC_IS_NULL(iglobals))
-        PANIC("iglobals isn?t created yet");
+        PANIC("iglobals isn't created yet");
     HashPointer = VTABLE_get_pmc_keyed_int(interp, iglobals,
             IGLOBALS_NCI_FUNCS);
 
--- src/memory.c.dist   2006-12-03 23:23:58.000000000 +0200
+++ src/memory.c        2006-12-03 23:24:27.000000000 +0200
@@ -80,7 +80,7 @@
 #ifdef DETAIL_MEMORY_DEBUG
     fprintf(stderr, "Allocated %i at %p\n", size, ptr);
 #endif
-    if (!ptr)
+    if (!ptr && size)
         PANIC("Out of mem");
     return ptr;
 }
@@ -93,7 +93,7 @@
     fprintf(stderr, "Internal malloc %i at %p (%s/%d)\n",
             size, ptr, file, line);
 #endif
-    if (!ptr)
+    if (!ptr && size)
         PANIC("Out of mem");
     return ptr;
 }

Reply via email to