This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to poison alloca in generator (HOST) files
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Nov 2001 11:36:21 -0500 (EST)
- Subject: Patch to poison alloca in generator (HOST) files
We should poison alloca for files which don't link with libiberty so
that it doesn't creep in and break builds where the stage1 compiler is
cc. See: http://gcc.gnu.org/ml/gcc-bugs/2001-11/msg00467.html
So here's a patch to do that. Okay to install once Alan fixes the
current alloca bootstrap problem?
Thanks,
--Kaveh
2001-11-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* bitmap.h (BITMAP_ALLOCA): Hide unused macro calling alloca.
* system.h: Poison alloca if GENERATOR_FILE is defined.
diff -rup orig/egcs-CVS20011114/gcc/bitmap.h egcs-CVS20011114/gcc/bitmap.h
--- orig/egcs-CVS20011114/gcc/bitmap.h Thu Oct 11 16:30:24 2001
+++ egcs-CVS20011114/gcc/bitmap.h Thu Nov 15 11:11:27 2001
@@ -123,6 +123,7 @@ extern int bitmap_last_set_bit PARAMS((b
returned by alloca and pass that variable to bitmap_initialize().
PTR is then set to the value returned from bitmap_initialize() to
avoid having it appear more than once in case it has side effects. */
+#if 0
#define BITMAP_ALLOCA(PTR) \
do { \
bitmap temp_bitmap_ = (bitmap) alloca (sizeof (bitmap_head)); \
@@ -132,6 +133,7 @@ do { \
/* Allocate a bitmap with xmalloc. */
#define BITMAP_XMALLOC() \
bitmap_initialize ((bitmap) xmalloc (sizeof (bitmap_head)))
+#endif
/* Do any cleanup needed on a bitmap when it is no longer used. */
#define BITMAP_FREE(BITMAP) \
diff -rup orig/egcs-CVS20011114/gcc/system.h egcs-CVS20011114/gcc/system.h
--- orig/egcs-CVS20011114/gcc/system.h Sun Oct 28 08:57:57 2001
+++ egcs-CVS20011114/gcc/system.h Thu Nov 15 11:04:54 2001
@@ -594,6 +594,12 @@ typedef union tree_node *tree;
#undef calloc
#undef strdup
#pragma GCC poison malloc realloc calloc strdup
+/* We shouldn't be using alloca in any generator file since they don't
+ link with libiberty. */
+#ifdef GENERATOR_FILE
+#undef alloca
+ #pragma GCC poison alloca
+#endif
/* Old target macros that have moved to the target hooks structure. */
#pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN \