* [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single
@ 2023-12-10 14:59 xndcn
2023-12-10 15:20 ` xndcn
2023-12-11 7:56 ` Richard Biener
0 siblings, 2 replies; 7+ messages in thread
From: xndcn @ 2023-12-10 14:59 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1.1: Type: text/plain, Size: 244 bytes --]
Hi, I am a newbie in GCC, and I do not have access to git repo.
I found some misleading error messages in verify_gimple_assign_single
function of tree-cfg.cc. It prompt error "invalid RHS for gimple memory
store: ", but it checks lhs in fact.
[-- Attachment #2: 0001-tree-cfg-Fix-misleading-error-message-in-verify_gimp.patch --]
[-- Type: text/x-patch, Size: 1446 bytes --]
From 72fc4abe635c3e35ac31457aeba92b528f0574fe Mon Sep 17 00:00:00 2001
From: xndcn <xndchn@gmail.com>
Date: Sun, 10 Dec 2023 22:38:16 +0800
Subject: [PATCH] tree-cfg: Fix misleading error message in
verify_gimple_assign_single.
gcc/ChangeLog:
* tree-cfg.cc (verify_gimple_assign_single): Fix misleading error, from "invalid LHS ..." to "invalid RHS ..."
Signed-off-by: xndcn <xndchn@gmail.com>
---
gcc/tree-cfg.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index d784b9115..f041786b3 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -4695,7 +4695,7 @@ verify_gimple_assign_single (gassign *stmt)
if (!is_gimple_reg (lhs)
&& is_gimple_reg_type (TREE_TYPE (lhs)))
{
- error ("invalid RHS for gimple memory store: %qs", code_name);
+ error ("invalid LHS for gimple memory store: %qs", code_name);
debug_generic_stmt (lhs);
debug_generic_stmt (rhs1);
return true;
@@ -4721,7 +4721,10 @@ verify_gimple_assign_single (gassign *stmt)
&& !is_gimple_reg (rhs1)
&& is_gimple_reg_type (TREE_TYPE (lhs)))
{
- error ("invalid RHS for gimple memory store: %qs", code_name);
+ if (!is_gimple_reg (rhs1))
+ error ("invalid RHS for gimple memory store: %qs", code_name);
+ else
+ error ("invalid LHS for gimple memory store: %qs", code_name);
debug_generic_stmt (lhs);
debug_generic_stmt (rhs1);
return true;
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single
2023-12-10 14:59 [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single xndcn
@ 2023-12-10 15:20 ` xndcn
2023-12-10 15:20 ` xndcn
2023-12-11 7:56 ` Richard Biener
1 sibling, 1 reply; 7+ messages in thread
From: xndcn @ 2023-12-10 15:20 UTC (permalink / raw)
To: gcc-patches
Sorry about the attachment, re-paste here
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single.
2023-12-10 15:20 ` xndcn
@ 2023-12-10 15:20 ` xndcn
0 siblings, 0 replies; 7+ messages in thread
From: xndcn @ 2023-12-10 15:20 UTC (permalink / raw)
To: gcc-patches; +Cc: xndcn
gcc/ChangeLog:
* tree-cfg.cc (verify_gimple_assign_single): Fix misleading error, from "invalid LHS ..." to "invalid RHS ..."
Signed-off-by: xndcn <xndchn@gmail.com>
---
gcc/tree-cfg.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index d784b9115..f041786b3 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -4695,7 +4695,7 @@ verify_gimple_assign_single (gassign *stmt)
if (!is_gimple_reg (lhs)
&& is_gimple_reg_type (TREE_TYPE (lhs)))
{
- error ("invalid RHS for gimple memory store: %qs", code_name);
+ error ("invalid LHS for gimple memory store: %qs", code_name);
debug_generic_stmt (lhs);
debug_generic_stmt (rhs1);
return true;
@@ -4721,7 +4721,10 @@ verify_gimple_assign_single (gassign *stmt)
&& !is_gimple_reg (rhs1)
&& is_gimple_reg_type (TREE_TYPE (lhs)))
{
- error ("invalid RHS for gimple memory store: %qs", code_name);
+ if (!is_gimple_reg (rhs1))
+ error ("invalid RHS for gimple memory store: %qs", code_name);
+ else
+ error ("invalid LHS for gimple memory store: %qs", code_name);
debug_generic_stmt (lhs);
debug_generic_stmt (rhs1);
return true;
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single
2023-12-10 14:59 [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single xndcn
2023-12-10 15:20 ` xndcn
@ 2023-12-11 7:56 ` Richard Biener
2023-12-11 11:38 ` xndcn
1 sibling, 1 reply; 7+ messages in thread
From: Richard Biener @ 2023-12-11 7:56 UTC (permalink / raw)
To: xndcn; +Cc: gcc-patches
On Sun, Dec 10, 2023 at 4:00 PM xndcn <xndchn@gmail.com> wrote:
>
> Hi, I am a newbie in GCC, and I do not have access to git repo.
>
> I found some misleading error messages in verify_gimple_assign_single function of tree-cfg.cc. It prompt error "invalid RHS for gimple memory store: ", but it checks lhs in fact.
it might be a bit confusing but it's correct. There is a store
because !is_gimple_reg (lhs)
and the only case !is_gimple_reg (rhs1) is correct is when this is an aggregate
copy (!is_gimple_reg_type (TREE_TYPE (lhs))). Otherwise the _RHS_ needs to be
a register.
Richard.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single
2023-12-11 7:56 ` Richard Biener
@ 2023-12-11 11:38 ` xndcn
2023-12-11 11:39 ` Richard Biener
0 siblings, 1 reply; 7+ messages in thread
From: xndcn @ 2023-12-11 11:38 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 825 bytes --]
Got it, thanks! It is really confusing >,<
What about the first one? For case MEM_REF.
在 2023年12月11日星期一,Richard Biener <richard.guenther@gmail.com> 写道:
> On Sun, Dec 10, 2023 at 4:00 PM xndcn <xndchn@gmail.com> wrote:
> >
> > Hi, I am a newbie in GCC, and I do not have access to git repo.
> >
> > I found some misleading error messages in verify_gimple_assign_single
> function of tree-cfg.cc. It prompt error "invalid RHS for gimple memory
> store: ", but it checks lhs in fact.
>
> it might be a bit confusing but it's correct. There is a store
> because !is_gimple_reg (lhs)
> and the only case !is_gimple_reg (rhs1) is correct is when this is an
> aggregate
> copy (!is_gimple_reg_type (TREE_TYPE (lhs))). Otherwise the _RHS_ needs
> to be
> a register.
>
> Richard.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single
2023-12-11 11:38 ` xndcn
@ 2023-12-11 11:39 ` Richard Biener
2023-12-11 12:02 ` xndcn
0 siblings, 1 reply; 7+ messages in thread
From: Richard Biener @ 2023-12-11 11:39 UTC (permalink / raw)
To: xndcn; +Cc: gcc-patches
On Mon, Dec 11, 2023 at 12:39 PM xndcn <xndchn@gmail.com> wrote:
>
> Got it, thanks! It is really confusing >,<
> What about the first one? For case MEM_REF.
The same - the LHS determines this is a store, if it is the
RHS is invalid as diagnosed (it needs to go through a
temporary).
Richard.
> 在 2023年12月11日星期一,Richard Biener <richard.guenther@gmail.com> 写道:
>>
>> On Sun, Dec 10, 2023 at 4:00 PM xndcn <xndchn@gmail.com> wrote:
>> >
>> > Hi, I am a newbie in GCC, and I do not have access to git repo.
>> >
>> > I found some misleading error messages in verify_gimple_assign_single function of tree-cfg.cc. It prompt error "invalid RHS for gimple memory store: ", but it checks lhs in fact.
>>
>> it might be a bit confusing but it's correct. There is a store
>> because !is_gimple_reg (lhs)
>> and the only case !is_gimple_reg (rhs1) is correct is when this is an aggregate
>> copy (!is_gimple_reg_type (TREE_TYPE (lhs))). Otherwise the _RHS_ needs to be
>> a register.
>>
>> Richard.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single
2023-12-11 11:39 ` Richard Biener
@ 2023-12-11 12:02 ` xndcn
0 siblings, 0 replies; 7+ messages in thread
From: xndcn @ 2023-12-11 12:02 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]
Thanks, now I have totally understand! I think it deserves a clearer
prompt, but I do not have a better idea currently. So forget it, thanks!
在 2023年12月11日星期一,Richard Biener <richard.guenther@gmail.com> 写道:
> On Mon, Dec 11, 2023 at 12:39 PM xndcn <xndchn@gmail.com> wrote:
> >
> > Got it, thanks! It is really confusing >,<
> > What about the first one? For case MEM_REF.
>
> The same - the LHS determines this is a store, if it is the
> RHS is invalid as diagnosed (it needs to go through a
> temporary).
>
> Richard.
>
>
>
> > 在 2023年12月11日星期一,Richard Biener <richard.guenther@gmail.com> 写道:
> >>
> >> On Sun, Dec 10, 2023 at 4:00 PM xndcn <xndchn@gmail.com> wrote:
> >> >
> >> > Hi, I am a newbie in GCC, and I do not have access to git repo.
> >> >
> >> > I found some misleading error messages in verify_gimple_assign_single
> function of tree-cfg.cc. It prompt error "invalid RHS for gimple memory
> store: ", but it checks lhs in fact.
> >>
> >> it might be a bit confusing but it's correct. There is a store
> >> because !is_gimple_reg (lhs)
> >> and the only case !is_gimple_reg (rhs1) is correct is when this is an
> aggregate
> >> copy (!is_gimple_reg_type (TREE_TYPE (lhs))). Otherwise the _RHS_
> needs to be
> >> a register.
> >>
> >> Richard.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-12-11 12:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-10 14:59 [PATCH] tree-cfg: Fix misleading error message in verify_gimple_assign_single xndcn
2023-12-10 15:20 ` xndcn
2023-12-10 15:20 ` xndcn
2023-12-11 7:56 ` Richard Biener
2023-12-11 11:38 ` xndcn
2023-12-11 11:39 ` Richard Biener
2023-12-11 12:02 ` xndcn
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).