public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
@ 2023-06-08 0:16 pinskia at gcc dot gnu.org
2023-06-08 0:17 ` [Bug tree-optimization/110166] " pinskia 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-08 0:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
Bug ID: 110166
Summary: [14 Regression] wrong code with signed 1-bit integers
sometimes since r14-868-gb06cfb62229f
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Full tyestcase:
```
struct s
{
int t : 1;
int t1 : 1;
};
[[gnu::noipa]]
int f(struct s t)
{
int c = t.t;
int d = t.t1;
if (c > d)
t.t = d;
else
t.t = c;
return t.t;
}
int main(void)
{
struct s t;
for(int i = -1;i <= 0; i++)
{
for(int j = -1;j <= 0; j++)
{
int r = f((struct s){i, j});
int exp = i < j ? i : j;
if (exp != r)
__builtin_abort();
}
}
}
```
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110166] [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
@ 2023-06-08 0:17 ` pinskia at gcc dot gnu.org
2023-06-08 2:11 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-08 0:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Target Milestone|--- |14.0
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2023-06-08
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Forgot to mention this needs -O1 (-O2 compiles it correctly because of another
issue).
MIne.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110166] [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
2023-06-08 0:17 ` [Bug tree-optimization/110166] " pinskia at gcc dot gnu.org
@ 2023-06-08 2:11 ` pinskia at gcc dot gnu.org
2023-06-09 6:53 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-08 2:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
/* Max<bool0, bool1> -> bool0 | bool1
Min<bool0, bool1> -> bool0 & bool1 . */
(for op (max min)
logic (bit_ior bit_and)
(simplify
(op zero_one_valued_p@0 zero_one_valued_p@1)
(if (TYPE_PRECISION (type) != 1
|| TYPE_UNSIGNED (type))
(logic @0 @1))))
```
Should fix it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110166] [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
2023-06-08 0:17 ` [Bug tree-optimization/110166] " pinskia at gcc dot gnu.org
2023-06-08 2:11 ` pinskia at gcc dot gnu.org
@ 2023-06-09 6:53 ` rguenth at gcc dot gnu.org
2023-06-09 14:15 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-09 6:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110166] [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-06-09 6:53 ` rguenth at gcc dot gnu.org
@ 2023-06-09 14:15 ` cvs-commit at gcc dot gnu.org
2023-06-09 14:17 ` pinskia 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-09 14:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:72e652f3425079259faa4edefe1dc571f72f91e0
commit r14-1653-g72e652f3425079259faa4edefe1dc571f72f91e0
Author: Andrew Pinski <apinski@marvell.com>
Date: Thu Jun 8 14:25:51 2023 -0700
MATCH: Fix zero_one_valued_p not to match signed 1 bit integers
So for the attached testcase, we assumed that zero_one_valued_p would
be the value [0,1] but currently zero_one_valued_p matches also
signed 1 bit integers.
This changes that not to match that and fixes the 2 new testcases at
all optimization levels.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
Note the GCC 13 patch will be slightly different due to the changes
made to zero_one_valued_p.
PR tree-optimization/110165
PR tree-optimization/110166
gcc/ChangeLog:
* match.pd (zero_one_valued_p): Don't accept
signed 1-bit integers.
gcc/testsuite/ChangeLog:
* gcc.c-torture/execute/pr110165-1.c: New test.
* gcc.c-torture/execute/pr110166-1.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110166] [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-06-09 14:15 ` cvs-commit at gcc dot gnu.org
@ 2023-06-09 14:17 ` pinskia at gcc dot gnu.org
2023-06-09 22:13 ` cvs-commit at gcc dot gnu.org
2023-06-09 22:16 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-09 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110166] [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2023-06-09 14:17 ` pinskia at gcc dot gnu.org
@ 2023-06-09 22:13 ` cvs-commit at gcc dot gnu.org
2023-06-09 22:16 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-09 22:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:682bbd364708fe371b8f34546d970051cdbbfd4c
commit r13-7434-g682bbd364708fe371b8f34546d970051cdbbfd4c
Author: Andrew Pinski <apinski@marvell.com>
Date: Thu Jun 8 14:25:51 2023 -0700
MATCH: Fix zero_one_valued_p not to match signed 1 bit integers
So for the attached testcase, we assumed that zero_one_valued_p would
be the value [0,1] but currently zero_one_valued_p matches also
signed 1 bit integers.
This changes that not to match that and fixes the 2 new testcases at
all optimization levels.
OK for GCC 13? Bootstrapped and tested on x86_64-linux-gnu with no
regressions.
PR tree-optimization/110165
PR tree-optimization/110166
gcc/ChangeLog:
* match.pd (zero_one_valued_p): Don't accept
signed 1-bit integers.
gcc/testsuite/ChangeLog:
* gcc.c-torture/execute/pr110165-1.c: New test.
* gcc.c-torture/execute/pr110166-1.c: New test.
(cherry picked from commit 72e652f3425079259faa4edefe1dc571f72f91e0)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110166] [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2023-06-09 22:13 ` cvs-commit at gcc dot gnu.org
@ 2023-06-09 22:16 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-09 22:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110166
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The fix was backported in GCC 13 though the match pattern which introduced this
was not in GCC 13 so keeping this recorded as fixed for GCC 14.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-06-09 22:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 0:16 [Bug tree-optimization/110166] New: [14 Regression] wrong code with signed 1-bit integers sometimes since r14-868-gb06cfb62229f pinskia at gcc dot gnu.org
2023-06-08 0:17 ` [Bug tree-optimization/110166] " pinskia at gcc dot gnu.org
2023-06-08 2:11 ` pinskia at gcc dot gnu.org
2023-06-09 6:53 ` rguenth at gcc dot gnu.org
2023-06-09 14:15 ` cvs-commit at gcc dot gnu.org
2023-06-09 14:17 ` pinskia at gcc dot gnu.org
2023-06-09 22:13 ` cvs-commit at gcc dot gnu.org
2023-06-09 22:16 ` 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).