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]

[PATCH] Fix resolve_asm_operand_names


Hi!

This patch makes sure we don't replace %%[foo] in asm patterns,
only %[foo] or %%%[foo].

void foo (void)
{
  asm volatile ("%%[a] %[a] %%%[a] %%[a] %[a]" : : [a] "i" (6));
}
before:	%0 $6 %$6 %0 $6
after:	%[a] $6 %$6 %[a] $6

Ok for trunk?

2010-06-10  Jakub Jelinek  <jakub@redhat.com>

	* stmt.c (resolve_asm_operand_names): Fix handling
	of %%.

--- gcc/stmt.c.jj	2010-05-25 11:27:47.000000000 +0200
+++ gcc/stmt.c	2010-06-10 14:59:49.000000000 +0200
@@ -1319,7 +1319,7 @@ resolve_asm_operand_names (tree string, 
 	break;
       else
 	{
-	  c += 1;
+	  c += 1 + (c[1] == '%');
 	  continue;
 	}
     }
@@ -1341,7 +1341,7 @@ resolve_asm_operand_names (tree string, 
 	    p += 2;
 	  else
 	    {
-	      p += 1;
+	      p += 1 + (p[1] == '%');
 	      continue;
 	    }
 

	Jakub


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