public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512
@ 2020-05-29  5:18 vsevolod.livinskij at frtk dot ru
  2020-05-29  7:08 ` [Bug tree-optimization/95401] GCC produces incorrect instruction with -O3 for AVX2 rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: vsevolod.livinskij at frtk dot ru @ 2020-05-29  5:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

            Bug ID: 95401
           Summary: GCC produces incorrect instruction with -O3 for
                    skylake-avx512
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskij at frtk dot ru
  Target Milestone: ---

GCC produces incorrect instruction with -O3 for skylake-avx512 (also for
icelake-server and tigerlake).

Error:
>$ g++ -O3 func.cpp driver.cpp -march=skylake-avx512 && sde -skx -- ./a.out 
SDE ERROR:  TID: 0 executed instruction with an unaligned memory reference to
address 0x404064 INSTR: 0x000401201: IFORM: VMOVDQA_MEMdq_XMMdq :: vmovdqa
xmmword ptr [rcx*4+0x404060], xmm0
        IMAGE:   
/home/vlivinsk/workspace/yarpgen/bugs/may-28/gcc-miscompile/reduce/a.out
        FUNCTION: _Z4testv
        FUNCTION ADDR: 0x000401120

Reproducer:
driver.cpp
int var_9 = 1693986256, var_14;
int arr_16[11];
void test();
int main() { test(); }

func.cpp
extern int var_9;
extern unsigned var_14;
extern int arr_16[];
#include <algorithm>
void test() {
  for (short a = 0; a < (short)var_9; a += 12140)
    for (short b = 0; b < 8; b++)
      if (std::max(var_14, 1U))
        arr_16[a + b] = 0;
}

GCC version: 11.0.0 (5c715e6a2990cfb6c15acc1ee14219523534ec69)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] GCC produces incorrect instruction with -O3 for AVX2
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
@ 2020-05-29  7:08 ` rguenth at gcc dot gnu.org
  2020-05-29  7:16 ` [Bug tree-optimization/95401] [10/11 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-29  7:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
            Summary|GCC produces incorrect      |GCC produces incorrect
                   |instruction with -O3 for    |instruction with -O3 for
                   |skylake-avx512              |AVX2
             Target|                            |x86_64-*-* i?86-*-*
   Last reconfirmed|                            |2020-05-29

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed already with -mavx2.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10/11 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
  2020-05-29  7:08 ` [Bug tree-optimization/95401] GCC produces incorrect instruction with -O3 for AVX2 rguenth at gcc dot gnu.org
@ 2020-05-29  7:16 ` marxin at gcc dot gnu.org
  2020-05-29  7:31 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-29  7:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org
      Known to fail|                            |10.1.0, 11.0
      Known to work|                            |9.3.0
            Version|11.0                        |10.1.0
            Summary|GCC produces incorrect      |[10/11 Regression] GCC
                   |instruction with -O3 for    |produces incorrect
                   |AVX2                        |instruction with -O3 for
                   |                            |AVX2 since
                   |                            |r10-2257-g868363d4f52df19d

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-2257-g868363d4f52df19d.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10/11 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
  2020-05-29  7:08 ` [Bug tree-optimization/95401] GCC produces incorrect instruction with -O3 for AVX2 rguenth at gcc dot gnu.org
  2020-05-29  7:16 ` [Bug tree-optimization/95401] [10/11 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d marxin at gcc dot gnu.org
@ 2020-05-29  7:31 ` rguenth at gcc dot gnu.org
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-29  7:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.2
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10/11 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
                   ` (2 preceding siblings ...)
  2020-05-29  7:31 ` rguenth at gcc dot gnu.org
@ 2020-07-23  6:51 ` rguenth at gcc dot gnu.org
  2020-12-30 13:36 ` rsandifo at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |10.3

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10/11 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
                   ` (3 preceding siblings ...)
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
@ 2020-12-30 13:36 ` rsandifo at gcc dot gnu.org
  2021-01-05 10:59 ` [Bug tree-optimization/95401] [10 " rsandifo at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2020-12-30 13:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot gnu.org

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Seems to be caused by confusion around whether the alignment
argument to the IFN_MASK_* functions is measured in bits or bytes.
Testing a patch.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
                   ` (4 preceding siblings ...)
  2020-12-30 13:36 ` rsandifo at gcc dot gnu.org
@ 2021-01-05 10:59 ` rsandifo at gcc dot gnu.org
  2021-01-12 10:06 ` rsandifo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-01-05 10:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression] GCC      |[10 Regression] GCC
                   |produces incorrect          |produces incorrect
                   |instruction with -O3 for    |instruction with -O3 for
                   |AVX2 since                  |AVX2 since
                   |r10-2257-g868363d4f52df19d  |r10-2257-g868363d4f52df19d

--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed on trunk by r11-6447.  Backport pending.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
                   ` (5 preceding siblings ...)
  2021-01-05 10:59 ` [Bug tree-optimization/95401] [10 " rsandifo at gcc dot gnu.org
@ 2021-01-12 10:06 ` rsandifo at gcc dot gnu.org
  2021-03-05  5:10 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-01-12 10:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed for GCC 10 by r10-9260.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
                   ` (6 preceding siblings ...)
  2021-01-12 10:06 ` rsandifo at gcc dot gnu.org
@ 2021-03-05  5:10 ` aoliva at gcc dot gnu.org
  2021-03-05  8:03 ` rguenth at gcc dot gnu.org
  2021-03-11  7:00 ` aoliva at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-03-05  5:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #7 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
How important is it that the test added for this PR be split into two separate
source files?

I ask because, on targets that support vectors, but the vector unit is not
enabled in the default configuration, vect.exp makes compile the default
action, instead of run, and with additional sources, compile fails because one
can't compile multiple sources into a single asm output.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
                   ` (7 preceding siblings ...)
  2021-03-05  5:10 ` aoliva at gcc dot gnu.org
@ 2021-03-05  8:03 ` rguenth at gcc dot gnu.org
  2021-03-11  7:00 ` aoliva at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-05  8:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Alexandre Oliva from comment #7)
> How important is it that the test added for this PR be split into two
> separate source files?
> 
> I ask because, on targets that support vectors, but the vector unit is not
> enabled in the default configuration, vect.exp makes compile the default
> action, instead of run, and with additional sources, compile fails because
> one can't compile multiple sources into a single asm output.

Hmm, but that sounds like a mistake in the dg setup?  Anyway, if you can make
the testcase fail when combined (and some noipa attributes sprinkled around)
it's certainly fine to merge it into a single TU.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug tree-optimization/95401] [10 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d
  2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
                   ` (8 preceding siblings ...)
  2021-03-05  8:03 ` rguenth at gcc dot gnu.org
@ 2021-03-11  7:00 ` aoliva at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-03-11  7:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95401

--- Comment #9 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
It is definitely a problem in the dg infrastructure that compile mode doesn't
work with additional sources, but fixing that seems quite involved, more than I
can tackle right now.  I've tried to duplicate the problem with a single test
source file, with the compiler commit mentioned in the initial report, but
failed, and it wasn't just because of the type inconsistency between var_14
across the current units.  I suppose the alignment miscomputation, that caused
an aligned vector store insn to be incorrectly used, doesn't come up when the
alignment is known, and much stricter than what can be assumed for an external
symbol.  Oh well...

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-11  7:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  5:18 [Bug tree-optimization/95401] New: GCC produces incorrect instruction with -O3 for skylake-avx512 vsevolod.livinskij at frtk dot ru
2020-05-29  7:08 ` [Bug tree-optimization/95401] GCC produces incorrect instruction with -O3 for AVX2 rguenth at gcc dot gnu.org
2020-05-29  7:16 ` [Bug tree-optimization/95401] [10/11 Regression] GCC produces incorrect instruction with -O3 for AVX2 since r10-2257-g868363d4f52df19d marxin at gcc dot gnu.org
2020-05-29  7:31 ` rguenth at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2020-12-30 13:36 ` rsandifo at gcc dot gnu.org
2021-01-05 10:59 ` [Bug tree-optimization/95401] [10 " rsandifo at gcc dot gnu.org
2021-01-12 10:06 ` rsandifo at gcc dot gnu.org
2021-03-05  5:10 ` aoliva at gcc dot gnu.org
2021-03-05  8:03 ` rguenth at gcc dot gnu.org
2021-03-11  7:00 ` aoliva 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).