lkml.org 
[lkml]   [2013]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH, -v2] compiler/gcc4: Add quirk for 'asm goto' miscompilation bug
On Thu, Oct 10, 2013 at 10:55:06AM +0200, Ingo Molnar wrote:
> +/*
> + * GCC 'asm goto' miscompiles certain code sequences:
> + *
> + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
> + *
> + * Work it around via quirk suggested by Jakub Jelinek.
> + * Fixed in GCC 4.8.2 and later versions.
> + */
> +#if GCC_VERSION <= 40801

We didn't do version checks for CC_HAVE_ASM_GOTO because of vendor
backports; can't we detect this in the same way?

> +# define __asm_goto(vol, x...) do { asm vol goto(x); asm (""); } while (0)
> +#else
> +# define __asm_goto(vol, x...) do { asm vol goto(x); } while (0)
> +#endif

This places the asm("") in the fallthrough case; but Jakub wrote:

> @@ -8,6 +8,7 @@ foo (int a, int b)
> asm volatile goto ("bts $1, %0; jc %l[lab]" : : "m" (b) : "memory" : lab);
> return 0;
> lab:
> + asm ("");
> return 0;
> }

Which places the asm ("") after the label, these two are not the same.


\
 
 \ /
  Last update: 2013-10-10 14:21    [W:0.114 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site