No, the behavior of malloc(0) is implementation defined. 

-----Original Message-----
From: Bryan C. Warnock
To: [EMAIL PROTECTED]
Sent: 10/6/2001 12:43 PM
Subject: [PATCH] non-init var possibility

mask and max_to_alloc are unitialized if the size requested is less that
1.  
(Which it could be, since INTVAL is signed.)  Of course, if it happens,
you 
should get what you deserve, but this at least horks them cleanly.

Creation of an UINTVAL (UNTVAL? :-)  and subsequent patches will follow 
pending feedback.

Is the behavior of malloc(0) consistent?

Index: memory.c
===================================================================
RCS file: /home/perlcvs/parrot/memory.c,v
retrieving revision 1.12
diff -u -r1.12 memory.c
--- memory.c    2001/10/06 00:57:43     1.12
+++ memory.c    2001/10/06 17:39:55
@@ -40,8 +40,8 @@
 */
 void *
 mem_allocate_aligned(INTVAL size) {
-    ptrcast_t max_to_alloc;
-    ptrcast_t mask;
+    ptrcast_t max_to_alloc = 0;
+    ptrcast_t mask = 0;
     ptrcast_t i;
     void *mem = NULL;


-- 
Bryan C. Warnock
[EMAIL PROTECTED]

Reply via email to