This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [PATCH][SH] atomicity.h bug fix


[CC to libstdc++ list]

Andrew Stubbs <ams@codesourcery.com> wrote:
> This patch fixes a bug that can cause bad code at -O2 and above.
> 
> The problem is that the inline assembler can be given the same
> register for an input and a (different) output. This is not a
> problem if the outputs are only made after all the inputs have been
> read, but one is not, so an 'early clobber' constraint is required.
> 
> OK?

OK.  Thanks for the patch!

Regards,
	kaz

> 2009-09-11  Andrew Stubbs  <ams@codesourcery.com>
> 
>	* config/cpu/sh/atomicity.h (__exchange_and_add): Set earlyclobber
>	constraint.
> 
> --- a/libstdc++-v3/config/cpu/sh/atomicity.h
> +++ b/libstdc++-v3/config/cpu/sh/atomicity.h
> @@ -44,7 +44,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
>         "\tadd\t%3,r0\n"
>         "\tmovco.l\tr0,@%2\n"
>         "\tbf\t0b"
> -       : "+m" (*__mem), "=r" (__result)
> +       : "+m" (*__mem), "=&r" (__result)
>         : "r" (__mem), "rI08" (__val)
>         : "r0");


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