Hi,

Segher Boessenkool <seg...@kernel.crashing.org> writes:

> Oh, btw:
>
> On Tue, May 14, 2024 at 11:00:38AM +0800, Jiufu Guo wrote:
>> >> --- a/gcc/config/rs6000/rs6000.cc
>> >> +++ b/gcc/config/rs6000/rs6000.cc
>> >> @@ -14659,6 +14659,12 @@ print_operand_address (FILE *file, rtx x)
>> >>    else if (SYMBOL_REF_P (x) || GET_CODE (x) == CONST
>> >>      || GET_CODE (x) == LABEL_REF)
>> >>      {
>> >> +      if (this_is_asm_operands && !address_operand (x, VOIDmode))
>> >> + {
>> >> +   output_operand_lossage ("invalid expression as operand");
>> >> +   return;
>> >> + }
>
> That error message is not so good.  Firstly, it typically *is* a valid
> expression here, just not a correct expression to have for an address.
> But, more generally and usefully, the error message should say *what* is
> wrong about the expression (namely, it is not an address).

Thanks so much for your great review!
Reference other messages, I'm wondering "invalid %%a value" may be
acceptable, or "invalid %%a address expression in TOC" maybe better.

>
> Most of the time you can use the same error message for asm and other
> expressions, and you get a great message in all contexts.
> operand_lossage already takes care of telling the user "you did
> something foolish" for inline asm, or "ICE" if it is a compiler problem
> instead.
>
> In error messages you do not often know what caused the problem, so
> just report on the facts you *do* know (and moreso with warnings, there
> you typically only know something looks unusual).
>
Thanks again for helpful comments!

BR,
Jeff(Jiufu) Guo.

>
> Segher

Reply via email to