public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
@ 2023-12-12 12:28 22s302h0659 at sonline20 dot sen.go.kr
2023-12-12 19:03 ` [Bug target/112986] " jakub at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: 22s302h0659 at sonline20 dot sen.go.kr @ 2023-12-12 12:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
Bug ID: 112986
Summary: s390x gcc O2, O3: Incorrect logic operation in <
comparison with the same values
Product: gcc
Version: 11.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: 22s302h0659 at sonline20 dot sen.go.kr
Target Milestone: ---
# Environment
- Compiler: s390x-linux-gnu-gcc (64bit)
- Version: gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
- Platform: Windows 11_5.15.90.1-microsoft-standard-WSL2
- Build Optimization Options: O0, O1, O2, O3
I installed the s390x-linux-gnu toolchain using the 'apt' package manager in
Ubuntu and utilized s390x-linux-gnu-gcc (version 11.4.0) from it.
# build script & excution script
```c
s390x-linux-gnu-gcc -o bug0 bug.c -O0 -fsanitize=undefined
s390x-linux-gnu-gcc -o bug1 bug.c -O1 -fsanitize=undefined
s390x-linux-gnu-gcc -o bug2 bug.c -O2 -fsanitize=undefined
s390x-linux-gnu-gcc -o bug3 bug.c -O3 -fsanitize=undefined
```
```c
qemu-s390x-static -L /usr/s390x-linux-gnu/ ./bug0
qemu-s390x-static -L /usr/s390x-linux-gnu/ ./bug1
qemu-s390x-static -L /usr/s390x-linux-gnu/ ./bug2
qemu-s390x-static -L /usr/s390x-linux-gnu/ ./bug3
```
This is the build script and the execution script.
# Source Code
```c
#include <stdio.h>
unsigned int g_2 = 1;
signed short g_70 = 1;
int main (int argc, char* argv[])
{
printf("bug = %d\n", ((signed long long)g_2 < g_70));
return 0;
}
```
In the s390x architecture, the '<' comparison operation for the same values
returns an incorrect logical value.
# output
```c
Expected output
O0: 0
O1: 0
O2: 0
O3: 0
Actual output
O0: 0
O1: 0
O2: 1
O3: 1
```
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
@ 2023-12-12 19:03 ` jakub at gcc dot gnu.org
2023-12-13 18:05 ` krebbel at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-12 19:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
How was gcc configured (gcc -v should print that)? Mainly, what -march= and
-mtune= does it default to and is it PIE by default or not?
I certainly don't see anything in the -O1 vs. -O2 assembly difference that
would result in a different result.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
2023-12-12 19:03 ` [Bug target/112986] " jakub at gcc dot gnu.org
@ 2023-12-13 18:05 ` krebbel at gcc dot gnu.org
2023-12-13 18:15 ` krebbel at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: krebbel at gcc dot gnu.org @ 2023-12-13 18:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
Andreas Krebbel <krebbel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-12-13
CC| |iii at linux dot ibm.com
--- Comment #2 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
I can confirm the failure when running the binaries with qemu.
However, the binaries run as expected on real hardware. So it might rather be a
qemu issue.
@Ilya:Ubuntu 22.04 is using qemu 6.2.0. Is this perhaps something you have
fixed already?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
2023-12-12 19:03 ` [Bug target/112986] " jakub at gcc dot gnu.org
2023-12-13 18:05 ` krebbel at gcc dot gnu.org
@ 2023-12-13 18:15 ` krebbel at gcc dot gnu.org
2023-12-13 18:37 ` iii at linux dot ibm.com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: krebbel at gcc dot gnu.org @ 2023-12-13 18:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
--- Comment #3 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
*** Bug 112996 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
` (2 preceding siblings ...)
2023-12-13 18:15 ` krebbel at gcc dot gnu.org
@ 2023-12-13 18:37 ` iii at linux dot ibm.com
2023-12-14 6:40 ` 22s302h0659 at sonline20 dot sen.go.kr
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: iii at linux dot ibm.com @ 2023-12-13 18:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
--- Comment #4 from Ilya Leoshkevich <iii at linux dot ibm.com> ---
Hi,
Nina fixed this in v8.0.0
(https://gitlab.com/qemu-project/qemu/-/commit/54fce97cfcaf5463ee5f325bc1f1d4adc2772f38).
The fix was backported to v7.2.2
(https://gitlab.com/qemu-project/qemu/-/commit/17b032c6598ea756889f25e8d3e4cd9f2036669b),
but not to v6.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
` (3 preceding siblings ...)
2023-12-13 18:37 ` iii at linux dot ibm.com
@ 2023-12-14 6:40 ` 22s302h0659 at sonline20 dot sen.go.kr
2023-12-14 7:38 ` krebbel at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: 22s302h0659 at sonline20 dot sen.go.kr @ 2023-12-14 6:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
--- Comment #5 from 김대영 <22s302h0659 at sonline20 dot sen.go.kr> ---
Thank you for your response. Naturally, I anticipated that the issue might be
with the s390x architecture cross-compiler. However, unexpectedly, I was
unaware that qemu was generating incorrect instructions during the binary
execution process
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
` (4 preceding siblings ...)
2023-12-14 6:40 ` 22s302h0659 at sonline20 dot sen.go.kr
@ 2023-12-14 7:38 ` krebbel at gcc dot gnu.org
2023-12-14 7:52 ` krebbel at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: krebbel at gcc dot gnu.org @ 2023-12-14 7:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
Andreas Krebbel <krebbel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #6 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
No problem. Thanks for testing s390x!
I've requested the qemu fix to be included into Ubuntu 22.04. Closing the BZ
now.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
` (5 preceding siblings ...)
2023-12-14 7:38 ` krebbel at gcc dot gnu.org
@ 2023-12-14 7:52 ` krebbel at gcc dot gnu.org
2023-12-14 8:41 ` xry111 at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: krebbel at gcc dot gnu.org @ 2023-12-14 7:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
Andreas Krebbel <krebbel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |shinwogud12 at gmail dot com
--- Comment #7 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
*** Bug 112665 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
` (6 preceding siblings ...)
2023-12-14 7:52 ` krebbel at gcc dot gnu.org
@ 2023-12-14 8:41 ` xry111 at gcc dot gnu.org
2023-12-14 8:41 ` xry111 at gcc dot gnu.org
2023-12-14 8:42 ` xry111 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-14 8:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
--- Comment #8 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
*** Bug 112998 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
` (7 preceding siblings ...)
2023-12-14 8:41 ` xry111 at gcc dot gnu.org
@ 2023-12-14 8:41 ` xry111 at gcc dot gnu.org
2023-12-14 8:42 ` xry111 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-14 8:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
--- Comment #9 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
*** Bug 112329 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112986] s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
` (8 preceding siblings ...)
2023-12-14 8:41 ` xry111 at gcc dot gnu.org
@ 2023-12-14 8:42 ` xry111 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-14 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112986
--- Comment #10 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
*** Bug 112112 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-12-14 8:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12 12:28 [Bug c/112986] New: s390x gcc O2, O3: Incorrect logic operation in < comparison with the same values 22s302h0659 at sonline20 dot sen.go.kr
2023-12-12 19:03 ` [Bug target/112986] " jakub at gcc dot gnu.org
2023-12-13 18:05 ` krebbel at gcc dot gnu.org
2023-12-13 18:15 ` krebbel at gcc dot gnu.org
2023-12-13 18:37 ` iii at linux dot ibm.com
2023-12-14 6:40 ` 22s302h0659 at sonline20 dot sen.go.kr
2023-12-14 7:38 ` krebbel at gcc dot gnu.org
2023-12-14 7:52 ` krebbel at gcc dot gnu.org
2023-12-14 8:41 ` xry111 at gcc dot gnu.org
2023-12-14 8:41 ` xry111 at gcc dot gnu.org
2023-12-14 8:42 ` xry111 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).