This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: (new) Failure building GFortran (Cygwin)
- From: Ian Lance Taylor <iant at google dot com>
- To: Angelo Graziosi <angelo dot graziosi at alice dot it>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, gcc at gcc dot gnu dot org, Dave Korn <dave dot korn at artimi dot com>, gdr at integrable-solutions dot net
- Date: Mon, 07 Jul 2008 16:14:30 -0700
- Subject: Re: (new) Failure building GFortran (Cygwin)
- References: <486629E7.7030003@alice.it> <339c37f20806281308y78981c25h22fec3bddb77d60b@mail.gmail.com> <486F57D8.6060400@alice.it> <008a01c8dfab$344c0ca0$2708a8c0@CAM.ARTIMI.COM> <4871D596.5000105@alice.it> <m3d4lp35ej.fsf@google.com> <487296E2.1090003@alice.it>
Angelo Graziosi <angelo.graziosi@alice.it> writes:
> Ian Lance Taylor wrote:
>> It's valid, but it's not the right patch. The right patch is to use
>> XNEW and XCNEW from include/libiberty.h.
>>
>
> Gabriel Dos Reis in [1] wrote:
>> The idiom is to use XCNEWVAR(T) for xcalloc(1, sizeof(T)),
>> XNEWVAR(T) for xmalloc(sizeof(T)),...
>
>
> Gulp! I am a little confused... XNEW or XNEWVAR, etc.?
It is confusing.
> --- gcc-4.4-20080704.orig/gcc/ggc-page.c 2008-06-29 06:39:16.000000000 +0200
> +++ gcc-4.4-20080704/gcc/ggc-page.c 2008-07-05 12:00:20.906250000 +0200
> @@ -799,7 +799,7 @@
> alloc_size = GGC_QUIRE_SIZE * G.pagesize;
> else
> alloc_size = entry_size + G.pagesize - 1;
> - allocation = xmalloc (alloc_size);
> + allocation = XNEWVAR(char, alloc_size);
Actually, I think this should be XNEWVEC (char, alloc_size), though
the effect is similar when the type is char.
> @@ -842,7 +842,7 @@
> struct page_entry *e, *f = G.free_pages;
> for (a = enda - G.pagesize; a != page; a -= G.pagesize)
> {
> - e = xcalloc (1, page_entry_size);
> + e = XCNEWVAR(struct page_entry, page_entry_size);
Here XCNEWVAR is correct. There should be a space before the left
parenthesis.
Ian