Re: [PATCH] Make basic asm implicitly clobber memory, pr24414

2015-12-09 Thread Bernd Schmidt

On 12/09/2015 03:18 AM, Bernd Edlinger wrote:

Furthermore there is a documented use for asm(""): The empty assembler string 
is used to make a function
volatile, thus calls can not be optimized away.  But I think it is not 
necessary to make this clobber anything,
nor should it be an instruction scheduling barrier, as it used to be in the 
past.


Making that change seems risky; best not to make assumptions about how 
these are used. In any case,



... or should I wait for the next stage1?


I think that would be better.


Bernd


Re: [PATCH] Make basic asm implicitly clobber memory, pr24414

2015-12-09 Thread Bernd Edlinger
Hi,

On 09.12.2015 12:06 Bernd Schmidt wrote:
> On 12/09/2015 03:18 AM, Bernd Edlinger wrote:
>> Furthermore there is a documented use for asm(""): The empty 
>> assembler string is used to make a function
>> volatile, thus calls can not be optimized away.  But I think it is 
>> not necessary to make this clobber anything,
>> nor should it be an instruction scheduling barrier, as it used to be 
>> in the past.
>
> Making that change seems risky; best not to make assumptions about how 
> these are used. In any case,
>

So would you agree on the general direction of the patch,
if I drop the hunk in sched-deps.c ?


Thanks
Bernd.



Re: [PATCH] Make basic asm implicitly clobber memory, pr24414

2015-12-09 Thread Bernd Edlinger
Hi,

On 09.12.2015 16:48 Bernd Schmidt wrote:
> On 12/09/2015 04:09 PM, Bernd Edlinger wrote:
>
>> So would you agree on the general direction of the patch,
>> if I drop the hunk in sched-deps.c ?
>
> I'm not sure there was any consensus in that other thread, but I think 
> assuming that basic asms clobber memory and CC, can be justified. That 
> certainly seems like a safer default. Ideally though I think it would 
> be best if we could deprecate basic asms in functions, or at least 
> warn about them in -Wall.
>
>

Well no, we did not get to a consensus on the warning issue.

My personal gut feeling on that warning is a bit mixed...

If we have a -Wall-enabled warning on asm("..."), people who know next 
to nothing
about assembler will be encouraged to "fix" this warning in a part of 
the code which
they probably do not understand at all. This frightens me a bit.

Because I know they will soon find out, that adding a few colons fixes 
the warning, but
asm("...":::) is not any better IMHO.

For me, it is just very very unlikely that any piece of assembler really 
clobbers nothing
and has no inputs and no outputs at the same time, even it it looks so 
at first sight...

It is much more likely that someone forgot to fill in the clobber section.

So for me it would also be good to warn on asm("...":::) and require 
that, if they want
to fix this warning, they must at least write something in the clobber
section, like asm ("...":::"nothing"); that would be a new clobber name 
which can only
stand alone and, which can get stripped after the warning processing 
took place in the FE.

So I think a warning should warn on something that is so unusual that it 
is likely a bug.


Bernd.


Re: [PATCH] Make basic asm implicitly clobber memory, pr24414

2015-12-09 Thread Bernd Schmidt

On 12/09/2015 04:09 PM, Bernd Edlinger wrote:


So would you agree on the general direction of the patch,
if I drop the hunk in sched-deps.c ?


I'm not sure there was any consensus in that other thread, but I think 
assuming that basic asms clobber memory and CC, can be justified. That 
certainly seems like a safer default. Ideally though I think it would be 
best if we could deprecate basic asms in functions, or at least warn 
about them in -Wall.



Bernd