This is the mail archive of the 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: tidy some gimplifcation unsharing

On May 28, 2004, Alexandre Oliva <> wrote:

> On May 21, 2004, Richard Henderson <> 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?


> 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  <>

	* gimplify.c (copy_if_shared_r): Revert:
	2004-05-21  Richard Henderson  <>
	* 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.  */
-    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   
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

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