This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to poison alloca in generator (HOST) files - Include .md problem


"Kaveh R. Ghazi" wrote:
> 
> 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?

Built and run without regressions and committed.

-- 2001-11-15  Alan Matsuoka  <alanm@redhat.com>

        * gensupport.c  process_include : Change call to alloca to
        xmalloc.

Index: gensupport.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gensupport.c,v
retrieving revision 1.24
diff -d -c -p -r1.24 gensupport.c
*** gensupport.c        2001/11/14 20:17:07     1.24
--- gensupport.c        2001/11/15 16:48:05
*************** process_include (desc, lineno)
*** 223,229 ****
    const char *filename = XSTR (desc, 0);
    char *pathname = NULL;
    FILE *input_file;
!   char *fname;
    struct file_name_list *stackp;
    int flen;

--- 223,229 ----
    const char *filename = XSTR (desc, 0);
    char *pathname = NULL;
    FILE *input_file;
!   char *fname = NULL;
    struct file_name_list *stackp;
    int flen;

*************** process_include (desc, lineno)
*** 257,263 ****

        flen = strlen (filename);

!       fname = (char *) alloca (max_include_len + flen + 2);

        /* + 2 above for slash and terminating null.  */

--- 257,263 ----

        flen = strlen (filename);

!       fname = (char *) xmalloc (max_include_len + flen + 2);

        /* + 2 above for slash and terminating null.  */

*************** process_include (desc, lineno)
*** 312,317 ****
--- 312,319 ----
    if (init_include_reader (input_file) == FATAL_EXIT_CODE)
      message_with_line (lineno, "read errors found in include file 
%s\n", pathname);

+   if (fname)
+     free (fname);
    return SUCCESS_EXIT_CODE;
  }
 

Alan Matsuoka
GCC Engineering
Red Hat Canada, Ltd
mailto:alanm@redhat.com Tel: (416) 482-2661 x250 / Fax: (416) 482-6299


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]