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: [vta,trunk?] inlining gen_rtvec_v into gen_rtvec warns


Alexandre Oliva wrote:
On Aug 12, 2008, "Richard Guenther" <richard.guenther@gmail.com> wrote:

2008/8/12 Alexandre Oliva <aoliva@redhat.com>:
Bootstrapping with -O3 on x86/64? causes gen_rtvec_v() to be inlined
into gen_rtvec(). This in turns causes the test for n == 0, already
performed in the caller, to be warned about, since it's always false.
I don't think it is appropriate to warn in this case, but this patches
permits bootstrap with -O3 to succeed.

Why not fix gen_rtvec instead to not allocate the temporary array
on the stack?

Err... I don't understand how the allocation of the temporary array on the stack relates with the warning about the redundant (after inlining) test for n == 0. Can you please elaborate?

I think he means just rewrite it to not copy the info and then call gen_rtvec_v. There is less copying around then too. something like:


/*VARARGS1*/ rtvec gen_rtvec (int n, ...) { int i; rtvec rt_val; va_list p;

va_start (p, n);

 if (n == 0)
   return NULL_RTVEC;          /* Don't allocate an empty rtvec...     */

rt_val = rtvec_alloc (n); /* Allocate an rtvec... */

 for (i = 0; i < n; i++)
   rt_val->elem[i] = va_arg (p, rtx);

va_end (p);

 return rt_val;
}



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