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

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).