* [PATCH][TUPLES] Fix for va_start related problems and an ICE.
@ 2008-03-28 5:27 Doug Kwan (關振德)
2008-03-28 6:04 ` Diego Novillo
0 siblings, 1 reply; 5+ messages in thread
From: Doug Kwan (關振德) @ 2008-03-28 5:27 UTC (permalink / raw)
To: Diego Novillo, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
Diego,
This patch fixes two problem. The first one is that
gimplify_call_expr() exit too early for __builtin_va_start() so that
it is missing in gimple statements. The second problem is that we do
not update gimple bodies when we merge declarations. The patch fixes
467 C failures and 222 Fortran failures.
-Doug
------------
2008-03-27 Doug Kwan <dougkwan@google.com>
* c-decl.c (merge_decls): Also copy gimpel body of decls.
* gimplify.c (gimplify_call_expr): Do not exit early when
gimplifying __builtin_va_start().
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2831 bytes --]
Index: c-decl.c
===================================================================
--- c-decl.c (revision 133657)
+++ c-decl.c (working copy)
@@ -1853,6 +1853,7 @@ merge_decls (tree newdecl, tree olddecl,
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl);
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
+ gimple_set_body (newdecl, gimple_body (olddecl));
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
/* Set DECL_INLINE on the declaration if we've got a body
@@ -1887,6 +1888,10 @@ merge_decls (tree newdecl, tree olddecl,
sizeof (struct tree_decl_common) - sizeof (struct tree_common));
switch (TREE_CODE (olddecl))
{
+ case FUNCTION_DECL:
+ gimple_set_body (olddecl, gimple_body (newdecl));
+ /* fall through */
+
case FIELD_DECL:
case VAR_DECL:
case PARM_DECL:
@@ -1894,7 +1899,6 @@ merge_decls (tree newdecl, tree olddecl,
case RESULT_DECL:
case CONST_DECL:
case TYPE_DECL:
- case FUNCTION_DECL:
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
(char *) newdecl + sizeof (struct tree_decl_common),
tree_code_size (TREE_CODE (olddecl)) - sizeof (struct tree_decl_common));
Index: gimplify.c
===================================================================
--- gimplify.c (revision 133657)
+++ gimplify.c (working copy)
@@ -2160,6 +2160,7 @@ gimplify_call_expr (tree *expr_p, gimple
int i, nargs;
VEC(tree, gc) *args = NULL;
gimple call;
+ bool builtin_va_start_p = FALSE;
gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
@@ -2197,6 +2198,7 @@ gimplify_call_expr (tree *expr_p, gimple
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_VA_START)
{
+ builtin_va_start_p = TRUE;
if (call_expr_nargs (*expr_p) < 2)
{
error ("too few arguments to function %<va_start%>");
@@ -2209,9 +2211,6 @@ gimplify_call_expr (tree *expr_p, gimple
*expr_p = build_empty_stmt ();
return GS_OK;
}
- /* Avoid gimplifying the second argument to va_start, which needs
- to be the plain PARM_DECL. */
- return gimplify_arg (&CALL_EXPR_ARG (*expr_p, 0), pre_p);
}
}
@@ -2329,10 +2328,15 @@ gimplify_call_expr (tree *expr_p, gimple
{
enum gimplify_status t;
- t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p);
+ /* Avoid gimplifying the second argument to va_start, which needs
+ to be the plain PARM_DECL. */
+ if ((i != 1) || !builtin_va_start_p)
+ {
+ t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p);
- if (t == GS_ERROR)
- ret = GS_ERROR;
+ if (t == GS_ERROR)
+ ret = GS_ERROR;
+ }
VEC_replace (tree, args, i, CALL_EXPR_ARG (*expr_p, i));
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][TUPLES] Fix for va_start related problems and an ICE.
2008-03-28 5:27 [PATCH][TUPLES] Fix for va_start related problems and an ICE Doug Kwan (關振德)
@ 2008-03-28 6:04 ` Diego Novillo
2008-03-28 7:44 ` Doug Kwan (關振德)
2008-04-03 13:48 ` Aldy Hernandez
0 siblings, 2 replies; 5+ messages in thread
From: Diego Novillo @ 2008-03-28 6:04 UTC (permalink / raw)
To: Doug Kwan (關振德); +Cc: gcc-patches
On Thu, Mar 27, 2008 at 22:26, Doug Kwan (關振紱) <dougkwan@google.com> wrote:
> The patch fixes 467 C failures and 222 Fortran failures.
Excellent! Thanks.
> 2008-03-27 Doug Kwan <dougkwan@google.com>
>
> * c-decl.c (merge_decls): Also copy gimpel body of decls.
> * gimplify.c (gimplify_call_expr): Do not exit early when
> gimplifying __builtin_va_start().
OK.
Diego.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][TUPLES] Fix for va_start related problems and an ICE.
2008-03-28 6:04 ` Diego Novillo
@ 2008-03-28 7:44 ` Doug Kwan (關振德)
2008-04-03 13:48 ` Aldy Hernandez
1 sibling, 0 replies; 5+ messages in thread
From: Doug Kwan (關振德) @ 2008-03-28 7:44 UTC (permalink / raw)
To: Diego Novillo; +Cc: gcc-patches
There is a typo in the ChangeLog entry. I will fix it before submitting.
-Doug
2008/3/27 Diego Novillo <dnovillo@google.com>:
> On Thu, Mar 27, 2008 at 22:26, Doug Kwan (關振德) <dougkwan@google.com> wrote:
>
> > The patch fixes 467 C failures and 222 Fortran failures.
>
> Excellent! Thanks.
>
>
>
> > 2008-03-27 Doug Kwan <dougkwan@google.com>
> >
> > * c-decl.c (merge_decls): Also copy gimpel body of decls.
> > * gimplify.c (gimplify_call_expr): Do not exit early when
> > gimplifying __builtin_va_start().
>
> OK.
>
>
> Diego.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][TUPLES] Fix for va_start related problems and an ICE.
2008-03-28 6:04 ` Diego Novillo
2008-03-28 7:44 ` Doug Kwan (關振德)
@ 2008-04-03 13:48 ` Aldy Hernandez
2008-04-03 16:51 ` Doug Kwan (關振德)
1 sibling, 1 reply; 5+ messages in thread
From: Aldy Hernandez @ 2008-04-03 13:48 UTC (permalink / raw)
To: Diego Novillo; +Cc: =?BIG5?B?RG91ZyBLd2FuICjD9q62vHcp?=, gcc-patches
>> * c-decl.c (merge_decls): Also copy gimpel body of decls.
Typo in changelog above.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][TUPLES] Fix for va_start related problems and an ICE.
2008-04-03 13:48 ` Aldy Hernandez
@ 2008-04-03 16:51 ` Doug Kwan (關振德)
0 siblings, 0 replies; 5+ messages in thread
From: Doug Kwan (關振德) @ 2008-04-03 16:51 UTC (permalink / raw)
To: Aldy Hernandez; +Cc: Diego Novillo, gcc-patches
I had noticed that and had fixed it before I committed the patch.
Thanks for reviewing
-Doug
2008/4/3 Aldy Hernandez <aldyh@redhat.com>:
>
> >> * c-decl.c (merge_decls): Also copy gimpel body of decls.
>
> Typo in changelog above.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-04-03 16:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-28 5:27 [PATCH][TUPLES] Fix for va_start related problems and an ICE Doug Kwan (關振德)
2008-03-28 6:04 ` Diego Novillo
2008-03-28 7:44 ` Doug Kwan (關振德)
2008-04-03 13:48 ` Aldy Hernandez
2008-04-03 16:51 ` Doug Kwan (關振德)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).