On 8/14/17, Alan Modra <amo...@gmail.com> wrote:
> On Sun, Aug 13, 2017 at 10:25:14PM +0930, Alan Modra wrote:
>> On Sun, Aug 13, 2017 at 03:35:15AM -0700, David Wohlferd wrote:
>> > Using "m"(*pStr) as an (unused) input parameter has no effect.
>>
>> Use "m" (*(const void *)pStr) and ignore the warning, or use
>> "m" (*(const struct {char a; char x[];} *) pStr).
>
> or even better "m" (*(const char (*)[]) pStr).
>
>> The issue is one of letting gcc know what memory is accessed by the
>> asm, if you don't want to use a "memory" clobber.  And there are very
>> good reasons to avoid clobbering all memory.
>>
>> "m"(*pStr) ought to work IMO, but apparently just tells gcc you are
>> only interested in the first character.  Of course that is exactly
>> what *pStr is, but in this context it would be nicer if it meant the
>> entire array.
>
> I take that back.  The relatively simple cast to differentiate a
> pointer to a char from a pointer to an indeterminate length char array
> makes it quite unnecessary for "m"(*pStr) to be treated as as array
> reference.
>
> I've opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845 to
> track the lack of documentation.
>

Alan, you might want to re-file that bug; it got lost in the Bugzilla
crash, and a different unrelated bug ended up taking its bug number...
(check the gcc-bugs archives)

> --
> Alan Modra
> Australia Development Lab, IBM
>

Reply via email to