Hi Andreas,

On 09/02/16 09:31, Andreas Schwab wrote:
> Greg Ungerer <[email protected]> writes:
>> Attached is a test case - derived from the original signal.c code.
> 
> It looks like with all those trivial functions in the non-MMU case the
> compiler sees enough to consider the writes to the (pseudo) function
> arguments dead.
> 
> How about this:
> 
> diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
> index af1c4f3..3cc9eaa 100644
> --- a/arch/m68k/kernel/signal.c
> +++ b/arch/m68k/kernel/signal.c
> @@ -757,6 +757,11 @@ asmlinkage int do_sigreturn(unsigned long __unused)
>  
>       if (restore_sigcontext(regs, &frame->sc, frame + 1))
>               goto badframe;
> +     /*
> +      * Force a barrier so that the compiler does not consider writes
> +      * to *sw and *regs as dead.
> +      */
> +     barrier();
>       return regs->d0;
>  
>  badframe:
> @@ -781,6 +786,11 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
>  
>       if (rt_restore_ucontext(regs, sw, &frame->uc))
>               goto badframe;
> +     /*
> +      * Force a barrier so that the compiler does not consider writes
> +      * to *sw and *regs as dead.
> +      */
> +     barrier();
>       return regs->d0;
>  
>  badframe:

Yes that works too. It forces generation of correct code.

So what is the best path forward here?
Should I submit a gcc bug report?

Regards
Greg


--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to