Patchwork Fix resolve_asm_operand_names

login
register
mail settings
Submitter Jakub Jelinek
Date June 10, 2010, 1:17 p.m.
Message ID <20100610131703.GL10293@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/55217/
State New
Headers show

Comments

Jakub Jelinek - June 10, 2010, 1:17 p.m.
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 %%.


	Jakub

Patch

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