On Tue, 18 May 2010, Jeffrey Lee wrote:

The easiest fix is likely to be to amend the NULL check that was added to __gcc_alloca_restore() for bug #174 so that it also returns if
(chunk->block != block). I'd have tested this myself by now, but something
is preventing my current source tree from building, so I'll have to try again in a day or two when I have some more time available to get my tree
working again.

After fixing my build issues, I can confirm that the attached patch fixes the problems I've been seeing. Want me to enter it as a bug report so it doesn't get forgotten?

Cheers,

- Jeffrey
Index: gcc4/recipe/files/gcc/libunixlib/gcccompat/galloca.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/gcccompat/galloca.c        (revision 4622)
+++ gcc4/recipe/files/gcc/libunixlib/gcccompat/galloca.c        (working copy)
@@ -193,11 +193,13 @@
   /* Bug 174: If GCC determines that a call to __gcc_alloca can never be 
reached,
      it will optimise it away. However, the subsequent call to 
__gcc_alloca_restore
      is left intact and, as a block was never allocated, crashes because
-     chunk == NULL . */
-  if (chunk == NULL)
+     chunk == NULL .
+     We also need to protect against chunk->block != block, for the situation 
where
+     __gcc_alloca has been skipped for this stack frame but the chunk list is
+     nonempty due to use of __gcc_alloca in a parent stack frame */
+  if ((chunk == NULL) || (chunk->block != block))
     return;
 
-  assert (chunk->block == block);
   assert (chunk->fp == callee_fp);
 
   /* Delete chunk with id block.  */
_______________________________________________
GCCSDK mailing list [email protected]
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Reply via email to