From: Segher Boessenkool <segher@kernel.crashing.org>
To: Jiufu Guo <guojiufu@linux.ibm.com>
Cc: "Kewen.Lin" <linkw@linux.ibm.com>,
dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] report message for operator %a on unaddressible exp
Date: Tue, 14 May 2024 04:20:54 -0500 [thread overview]
Message-ID: <20240514092054.GF19790@gate.crashing.org> (raw)
In-Reply-To: <h48ttj1ayi1.fsf@genoa.aus.stglabs.ibm.com>
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).
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).
Segher
next prev parent reply other threads:[~2024-05-14 9:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 2:57 Jiufu Guo
2024-05-13 6:27 ` Kewen.Lin
2024-05-14 3:00 ` Jiufu Guo
2024-05-14 3:15 ` Kewen.Lin
2024-05-14 3:32 ` Jiufu Guo
2024-05-14 9:11 ` Segher Boessenkool
2024-05-14 9:40 ` Jiufu Guo
2024-05-14 9:20 ` Segher Boessenkool [this message]
2024-05-14 9:53 ` Jiufu Guo
2024-05-14 10:43 ` Segher Boessenkool
2024-05-15 2:34 ` Jiufu Guo
2024-05-16 6:56 ` Jiufu Guo
2024-05-16 14:55 ` Segher Boessenkool
2024-05-13 11:03 ` Segher Boessenkool
2024-05-14 2:49 ` Jiufu Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240514092054.GF19790@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=guojiufu@linux.ibm.com \
--cc=linkw@gcc.gnu.org \
--cc=linkw@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).