This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: tidy some gimplifcation unsharing
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 07 Jun 2004 16:12:39 -0300
- Subject: Re: tidy some gimplifcation unsharing
- Organization: Red Hat Global Engineering Services Compiler Team
- References: <20040521220523.GA11618@redhat.com><orhdu0evfy.fsf@livre.redhat.lsd.ic.unicamp.br>
On May 28, 2004, Alexandre Oliva <aoliva@redhat.com> wrote:
> On May 21, 2004, Richard Henderson <rth@redhat.com> wrote:
>> The VA_ARG_EXPR thing is handled during gimplification elsewhere.
> But that's too late. We may have already expanded statements assuming
> variables referenced within VA_ARG_EXPRs are not volatile, in which
> case the stmts will fail gimple verification later. This broke the
> build of uClibc for frv-uclinux.
>> Don't mark VA_ARG_EXPRs volatile here.
> Ok to revert this bit?
Ping?
> Actually... There should be a comment explaining why it's there, to
> avoid having someone else make the same mistake. Ok to install this,
> if it bootstraps?
It does.
> I'll post a proper patch, with a ChangeLog entry, when I'm done
> testing.
Oops, I didn't post it. Here it is. Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* gimplify.c (copy_if_shared_r): Revert:
2004-05-21 Richard Henderson <rth@redhat.com>
* gimplify.c [...] Don't mark VA_ARG_EXPRs volatile here.
Index: gcc/gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.10
diff -u -p -r2.10 gimplify.c
--- gcc/gimplify.c 30 May 2004 18:32:26 -0000 2.10
+++ gcc/gimplify.c 7 Jun 2004 19:10:56 -0000
@@ -665,7 +665,19 @@ copy_if_shared_r (tree *tp, int *walk_su
/* Otherwise, mark the tree as visited and keep looking. */
else
- TREE_VISITED (t) = 1;
+ {
+ TREE_VISITED (t) = 1;
+ if (TREE_CODE (*tp) == VA_ARG_EXPR)
+ {
+ /* Mark any _DECL inside the operand as volatile to avoid
+ the optimizers messing around with it. We have to do this
+ early, otherwise we might mark a variable as volatile
+ after we gimplify other statements that use the variable
+ assuming it's not volatile. */
+ walk_tree (&TREE_OPERAND (*tp, 0), mark_decls_volatile_r,
+ NULL, NULL);
+ }
+ }
return NULL_TREE;
}
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}