public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110569] New: [14 Regression] Different results among -O0, -O1 and -Os
@ 2023-07-06 6:02 jwzeng at nuaa dot edu.cn
2023-07-06 6:12 ` [Bug tree-optimization/110569] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jwzeng at nuaa dot edu.cn @ 2023-07-06 6:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110569
Bug ID: 110569
Summary: [14 Regression] Different results among -O0, -O1 and
-Os
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jwzeng at nuaa dot edu.cn
Target Milestone: ---
Compiler explorer: https://godbolt.org/z/5qvhEnaoo
$ cat bug.c
int printf(const char *format, ...);
short a = 1;
unsigned int b[1][2][16][4];
signed char d[1][2][16][4];
unsigned int res;
#define min(a, b) ((a) < (b) ? (a) : (b))
int main() {
for (int i = 0; i < 16; ++i)
for (int j = 2; j < 4; ++j) {
d[0][1][i][j] = (signed char)-47;
}
for (signed char i = 0; i < 16; i += 4)
for (signed char j = 2; j < 10; j += 4)
res = min(1, a ? (unsigned short)d[0][1][i][2] : b[0][1][i][2 +
1]);
printf("%d\n", res);
}
$ gcc-tk -O0 bug.c
1
$ gcc-tk -O1 bug.c
65489
$ gcc-tk -Os bug.c
-47
$
$ gcc-tk -v
Using built-in specs.
COLLECT_GCC=/home/compilers/gcc/gcc-trunk/bin/gcc
COLLECT_LTO_WRAPPER=/home/compilers/gcc/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk-source/gcc/configure
--enable-languages=c,c++,fortran --enable-checking=release
--enable-valgrind-annotations --disable-werror --disable-libstdcxx-pch
--enable-libgomp --enable-lto --enable-gold --with-plugin-ld=gold
--prefix=/usr/local/gcc-trunk
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230703 (experimental) [master r14-2244-g1ebf37ece3] (GCC)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/110569] [14 Regression] Different results among -O0, -O1 and -Os
2023-07-06 6:02 [Bug tree-optimization/110569] New: [14 Regression] Different results among -O0, -O1 and -Os jwzeng at nuaa dot edu.cn
@ 2023-07-06 6:12 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-06 6:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110569
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Keywords| |wrong-code
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.
phiopt match-simplify trying:
_4 > 1 ? 1 : iftmp.3_32
Matching expression match.pd:1991, gimple-match-5.cc:23
Matching expression match.pd:1991, gimple-match-5.cc:23
Applying pattern match.pd:4763, gimple-match-7.cc:16232
Folded into the sequence:
_15 = _4 > 1;
_10 = (unsigned int) _15;
_9 = _10 | iftmp.3_32;
statement un-sinked:
iftmp.3_32 = (unsigned int) _4;
# RANGE [irange] unsigned int [0, 1] NONZERO 0x1
iftmp.3_32 = (unsigned intD.9) _4;
*** This bug has been marked as a duplicate of bug 110252 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-06 6:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 6:02 [Bug tree-optimization/110569] New: [14 Regression] Different results among -O0, -O1 and -Os jwzeng at nuaa dot edu.cn
2023-07-06 6:12 ` [Bug tree-optimization/110569] " 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).