public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98932] New: Wrong output with -O3 on aarch64
@ 2021-02-02 13:20 kristian.klausen at scoutdi dot com
2021-02-02 13:21 ` [Bug c++/98932] " kristian.klausen at scoutdi dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: kristian.klausen at scoutdi dot com @ 2021-02-02 13:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
Bug ID: 98932
Summary: Wrong output with -O3 on aarch64
Product: gcc
Version: 8.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kristian.klausen at scoutdi dot com
Target Milestone: ---
Hi,
I have been struggling with a vectorization issue, and have managed to
re-create to a minimal example as attached.
When compiled with `-O2` the correct output is produced, however when compiled
with `-O3` the output is bogus when compiled with gcc-8 and gcc-9. Gcc-7 gives
the correct output.
Tested with the following versions under qemu for aarch64:
```
g++-7 --version
g++-7 (Ubuntu/Linaro 7.5.0-6ubuntu2) 7.5.0
g++-8 --version
g++-8 (Ubuntu/Linaro 8.4.0-3ubuntu2) 8.4.0
g++-9 --version
g++-9 (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
```
Output:
```
:~# g++-9 -O3 a.cpp && ./a.out
Length is: 26348240
:~# g++-8 -O3 a.cpp && ./a.out
Length is: 26348240
:~# g++-7 -O3 a.cpp && ./a.out
Length is: 294
```
Also gave it a go with the suggested flags before filing the report:
```
g++-8 -O3 -Wall -Wextra -fno-strict-aliasing -fwrapv a.cpp && ./a.out
Length is: 26348240
```
The code gives the correct output with gcc-10:
```
g++-10 -O3 a.cpp && ./a.out
Length is: 294
g++-10 --version
g++-10 (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
```
Let me know if I can provide more information.
Best,
Kristian
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98932] Wrong output with -O3 on aarch64
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
@ 2021-02-02 13:21 ` kristian.klausen at scoutdi dot com
2021-02-02 13:24 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kristian.klausen at scoutdi dot com @ 2021-02-02 13:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
--- Comment #1 from Kristian <kristian.klausen at scoutdi dot com> ---
Created attachment 50115
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50115&action=edit
Test-case
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98932] Wrong output with -O3 on aarch64
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
2021-02-02 13:21 ` [Bug c++/98932] " kristian.klausen at scoutdi dot com
@ 2021-02-02 13:24 ` marxin at gcc dot gnu.org
2021-02-02 18:42 ` [Bug tree-optimization/98932] " marxin at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-02 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-02-02
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
CC| |marxin at gcc dot gnu.org
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
I'm going to bisect that..
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/98932] Wrong output with -O3 on aarch64
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
2021-02-02 13:21 ` [Bug c++/98932] " kristian.klausen at scoutdi dot com
2021-02-02 13:24 ` marxin at gcc dot gnu.org
@ 2021-02-02 18:42 ` marxin at gcc dot gnu.org
2021-02-03 8:25 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-02 18:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |11.0
CC| |rguenth at gcc dot gnu.org,
| |rsandifo at gcc dot gnu.org
Status|ASSIGNED |NEW
Assignee|marxin at gcc dot gnu.org |unassigned at gcc dot gnu.org
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok, so the issue was fixed in g:74166aabeb7f22990476b1169bba031b8323ee92, which
is about a preferred vector types.
So with the following patch:
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 9e88438b3c3..1e5a05a00b0 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -17351,14 +17351,14 @@ aarch64_autovectorize_vector_modes (vector_modes
*modes, bool)
TODO: We could support a limited form of V4QImode too, so that
we use 32-bit vectors for 8-bit elements. */
- V4HImode,
+// V4HImode,
/* Try using 64-bit vectors for 32-bit elements and 128-bit vectors
for 64-bit elements.
TODO: We could similarly support limited forms of V2QImode and V2HImode
for this case. */
- V2SImode
+// V2SImode
};
/* Try using N-byte SVE modes only after trying N-byte Advanced SIMD mode.
@@ -23901,8 +23901,8 @@ aarch64_libgcc_floating_mode_supported_p
#define TARGET_VECTORIZE_VEC_PERM_CONST \
aarch64_vectorize_vec_perm_const
-#undef TARGET_VECTORIZE_RELATED_MODE
-#define TARGET_VECTORIZE_RELATED_MODE aarch64_vectorize_related_mode
+//#undef TARGET_VECTORIZE_RELATED_MODE
+//#define TARGET_VECTORIZE_RELATED_MODE aarch64_vectorize_related_mode
#undef TARGET_VECTORIZE_GET_MASK_MODE
#define TARGET_VECTORIZE_GET_MASK_MODE aarch64_get_mask_mode
#undef TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE
I tracked that it was fixed with g:04b99da898a9817e72fedb4063589648b7961ac5,
which is a vectorizer related revision.
Thus it's likely dup of PR97236.
Can we backport the fixed into 8 and 9 branch?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/98932] Wrong output with -O3 on aarch64
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
` (2 preceding siblings ...)
2021-02-02 18:42 ` [Bug tree-optimization/98932] " marxin at gcc dot gnu.org
@ 2021-02-03 8:25 ` rguenth at gcc dot gnu.org
2021-02-05 11:15 ` kristian.klausen at scoutdi dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-03 8:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yes.
*** This bug has been marked as a duplicate of bug 97236 ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/98932] Wrong output with -O3 on aarch64
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
` (3 preceding siblings ...)
2021-02-03 8:25 ` rguenth at gcc dot gnu.org
@ 2021-02-05 11:15 ` kristian.klausen at scoutdi dot com
2021-02-05 11:36 ` marxin at gcc dot gnu.org
2021-02-05 11:45 ` kristian.klausen at scoutdi dot com
6 siblings, 0 replies; 8+ messages in thread
From: kristian.klausen at scoutdi dot com @ 2021-02-05 11:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
--- Comment #5 from Kristian <kristian.klausen at scoutdi dot com> ---
Thanks for such a swift reponse! Looking forward to testing the patches for
8.x.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/98932] Wrong output with -O3 on aarch64
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
` (4 preceding siblings ...)
2021-02-05 11:15 ` kristian.klausen at scoutdi dot com
@ 2021-02-05 11:36 ` marxin at gcc dot gnu.org
2021-02-05 11:45 ` kristian.klausen at scoutdi dot com
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-05 11:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Kristian from comment #5)
> Thanks for such a swift reponse! Looking forward to testing the patches for
> 8.x.
You're welcome. Just a note, please try to use the latest GCC release (version
10). GCC 8 will goes out of support quite soon and you will more likely receive
backports for serious bugs.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/98932] Wrong output with -O3 on aarch64
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
` (5 preceding siblings ...)
2021-02-05 11:36 ` marxin at gcc dot gnu.org
@ 2021-02-05 11:45 ` kristian.klausen at scoutdi dot com
6 siblings, 0 replies; 8+ messages in thread
From: kristian.klausen at scoutdi dot com @ 2021-02-05 11:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98932
--- Comment #7 from Kristian <kristian.klausen at scoutdi dot com> ---
Thanks!
Yes, I agree. We are however bound to earlier versions due to CUDA-dependency
on the NVIDIA Jetson-platforms:
https://github.com/OE4T/meta-tegra/wiki/Compatibility-notes
Hopefully NVIDIA will update their CUDA-libraries in due time.
Best,
Kristian
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-02-05 11:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 13:20 [Bug c++/98932] New: Wrong output with -O3 on aarch64 kristian.klausen at scoutdi dot com
2021-02-02 13:21 ` [Bug c++/98932] " kristian.klausen at scoutdi dot com
2021-02-02 13:24 ` marxin at gcc dot gnu.org
2021-02-02 18:42 ` [Bug tree-optimization/98932] " marxin at gcc dot gnu.org
2021-02-03 8:25 ` rguenth at gcc dot gnu.org
2021-02-05 11:15 ` kristian.klausen at scoutdi dot com
2021-02-05 11:36 ` marxin at gcc dot gnu.org
2021-02-05 11:45 ` kristian.klausen at scoutdi dot com
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).