public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/110200] New: genmatch generating questionable code with convert and !
@ 2023-06-09 23:19 pinskia at gcc dot gnu.org
2023-06-12 8:13 ` [Bug middle-end/110200] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-09 23:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
Bug ID: 110200
Summary: genmatch generating questionable code with convert and
!
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: build
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Add these two patterns to match.pd:
```
/* (convert)(a ? b : CST) -> (a ? (convert)b : CST1) */
(simplify
(convert (cond @0 @1 CONSTANT_CLASS_P@2))
(cond @0 (convert @1) (convert! @2)))
/* (convert)(a ? CST : b) -> (a ? CST1 : (convert)b) */
(simplify
(convert (cond @0 CONSTANT_CLASS_P@1 @2))
(cond @0 (convert! @1) (convert @2)))
```
And the code produced by genmatch for generic is:
```
{
tree _o1[1], _r1;
_o1[0] = captures[2];
if (TREE_TYPE (_o1[0]) != type)
_r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]);
if (EXPR_P (_r1))
goto next_after_fail867;
else
_r1 = _o1[0];
res_op2 = _r1;
}
```
I think there is a missing `{`/`}` pair around the fold_build1_loc/if/goto
statements.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/110200] genmatch generating questionable code with convert and !
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
@ 2023-06-12 8:13 ` rguenth at gcc dot gnu.org
2023-06-12 9:01 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-12 8:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-06-12
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, mine.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/110200] genmatch generating questionable code with convert and !
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
2023-06-12 8:13 ` [Bug middle-end/110200] " rguenth at gcc dot gnu.org
@ 2023-06-12 9:01 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:02 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-12 9:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:820d1aec89c43dbbc70d3d0b888201878388454c
commit r14-1706-g820d1aec89c43dbbc70d3d0b888201878388454c
Author: Richard Biener <rguenther@suse.de>
Date: Mon Jun 12 10:17:26 2023 +0200
middle-end/110200 - genmatch force-leaf and convert interaction
The following fixes code GENERIC generation for (convert! ...)
which currently generates
if (TREE_TYPE (_o1[0]) != type)
_r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]);
if (EXPR_P (_r1))
goto next_after_fail867;
else
_r1 = _o1[0];
where obviously braces are missing.
PR middle-end/110200
* genmatch.cc (expr::gen_transform): Put braces around
the if arm for the (convert ...) short-cut.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/110200] genmatch generating questionable code with convert and !
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
2023-06-12 8:13 ` [Bug middle-end/110200] " rguenth at gcc dot gnu.org
2023-06-12 9:01 ` cvs-commit at gcc dot gnu.org
@ 2023-06-12 9:02 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:30 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-12 9:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:73ae34bb693038829c05bed30d7ac623e67bde2e
commit r13-7439-g73ae34bb693038829c05bed30d7ac623e67bde2e
Author: Richard Biener <rguenther@suse.de>
Date: Mon Jun 12 10:17:26 2023 +0200
middle-end/110200 - genmatch force-leaf and convert interaction
The following fixes code GENERIC generation for (convert! ...)
which currently generates
if (TREE_TYPE (_o1[0]) != type)
_r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]);
if (EXPR_P (_r1))
goto next_after_fail867;
else
_r1 = _o1[0];
where obviously braces are missing.
PR middle-end/110200
* genmatch.cc (expr::gen_transform): Put braces around
the if arm for the (convert ...) short-cut.
(cherry picked from commit 820d1aec89c43dbbc70d3d0b888201878388454c)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/110200] genmatch generating questionable code with convert and !
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-06-12 9:02 ` cvs-commit at gcc dot gnu.org
@ 2023-06-12 9:30 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:46 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-12 9:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:d5f72834a4817b180625a540b99f5c1934c2e0b8
commit r12-9694-gd5f72834a4817b180625a540b99f5c1934c2e0b8
Author: Richard Biener <rguenther@suse.de>
Date: Mon Jun 12 10:17:26 2023 +0200
middle-end/110200 - genmatch force-leaf and convert interaction
The following fixes code GENERIC generation for (convert! ...)
which currently generates
if (TREE_TYPE (_o1[0]) != type)
_r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]);
if (EXPR_P (_r1))
goto next_after_fail867;
else
_r1 = _o1[0];
where obviously braces are missing.
PR middle-end/110200
* genmatch.cc (expr::gen_transform): Put braces around
the if arm for the (convert ...) short-cut.
(cherry picked from commit 820d1aec89c43dbbc70d3d0b888201878388454c)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/110200] genmatch generating questionable code with convert and !
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-06-12 9:30 ` cvs-commit at gcc dot gnu.org
@ 2023-06-12 9:46 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:47 ` rguenth at gcc dot gnu.org
2023-06-15 5:08 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-12 9:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:5bf1c33a5e619564e8602601cc1beebd99e1fb9e
commit r11-10856-g5bf1c33a5e619564e8602601cc1beebd99e1fb9e
Author: Richard Biener <rguenther@suse.de>
Date: Mon Jun 12 10:17:26 2023 +0200
middle-end/110200 - genmatch force-leaf and convert interaction
The following fixes code GENERIC generation for (convert! ...)
which currently generates
if (TREE_TYPE (_o1[0]) != type)
_r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]);
if (EXPR_P (_r1))
goto next_after_fail867;
else
_r1 = _o1[0];
where obviously braces are missing.
PR middle-end/110200
* genmatch.c (expr::gen_transform): Put braces around
the if arm for the (convert ...) short-cut.
(cherry picked from commit 820d1aec89c43dbbc70d3d0b888201878388454c)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/110200] genmatch generating questionable code with convert and !
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2023-06-12 9:46 ` cvs-commit at gcc dot gnu.org
@ 2023-06-12 9:47 ` rguenth at gcc dot gnu.org
2023-06-15 5:08 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-12 9:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/110200] genmatch generating questionable code with convert and !
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2023-06-12 9:47 ` rguenth at gcc dot gnu.org
@ 2023-06-15 5:08 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-15 5:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110200
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |11.4.1, 12.3.1, 13.1.1
Known to fail| |11.4.0, 12.3.0, 13.1.0
Target Milestone|--- |11.5
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-06-15 5:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 23:19 [Bug middle-end/110200] New: genmatch generating questionable code with convert and ! pinskia at gcc dot gnu.org
2023-06-12 8:13 ` [Bug middle-end/110200] " rguenth at gcc dot gnu.org
2023-06-12 9:01 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:02 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:30 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:46 ` cvs-commit at gcc dot gnu.org
2023-06-12 9:47 ` rguenth at gcc dot gnu.org
2023-06-15 5:08 ` pinskia at gcc dot gnu.org
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).