public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference
@ 2022-06-29  2:05 18307130172 at fudan dot edu.cn
  2022-06-29  2:09 ` [Bug c++/106131] " 18307130172 at fudan dot edu.cn
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: 18307130172 at fudan dot edu.cn @ 2022-06-29  2:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106131
           Summary: -fstrict-aliasing breaks normal program that does not
                    use any pointer or reference
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 18307130172 at fudan dot edu.cn
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

Created attachment 53220
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53220&action=edit
preprocessed source file

My program does not use any pointer or reference but is affected by
-fstrict-aliasing. Here is a minimal example to manifest this issue:

#include <vector>
#include <iostream>

using Pair = std::pair<int, int>;

std::vector<Pair> f = {{0, -11}, {0, -8}, {1, 2}};

int foo(Pair x, Pair y) {
    return std::max(x.second, y.second);
}

int main() {
    for (int J = 0; J < 1; J++) {
        f[J] = f[0];
        if(J == 0)
            f[J] = f[2];
        std::cout << foo(f[J], f[1]) << std::endl;
    }
}

Save it to main.cpp and compile it with:

g++ -O2 main.cpp

The expected output should be "2", but the optimized build output "-8". If
compiled with "-O2 -fno-strict-aliasing", the output is correct.

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

* [Bug c++/106131] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
@ 2022-06-29  2:09 ` 18307130172 at fudan dot edu.cn
  2022-06-29  2:36 ` pinskia at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: 18307130172 at fudan dot edu.cn @ 2022-06-29  2:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from 18307130172 at fudan dot edu.cn ---
Created attachment 53221
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53221&action=edit
output of g++ -v -O2 main.cpp

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

* [Bug c++/106131] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
  2022-06-29  2:09 ` [Bug c++/106131] " 18307130172 at fudan dot edu.cn
@ 2022-06-29  2:36 ` pinskia at gcc dot gnu.org
  2022-06-29  9:26 ` redi at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-29  2:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a slightly reduced (still has std::vector in it):

#include <vector>

template<class A, class B>
struct Pair1
{
      constexpr Pair1(const Pair1&) = default;
      constexpr Pair1(Pair1&&) = default;
      constexpr Pair1(const A& __a, const B& __b)
      : first(__a), second(__b) { }
       Pair1&
      operator=(  const Pair1 &   __p)
      {
        first = __p.first;
        second = __p.second;
        return *this;
      }
  A first;
  B second;
};
typedef Pair1<int, int> Pair;

std::vector<Pair> f = {{0, -11}, {0, -8}, {1, 2}};

int foo(Pair x, Pair y) {
    return std::max(x.second, y.second);
}

int main() {
    int t = 0;
    for (int J = 0; J < 1; J++) {
        f[J] = f[0];
        if(J == 0)
            f[J] = f[2];
        t = foo(f[J], f[1]);
    }
    if (t != 2)
      __builtin_abort();
}

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

* [Bug c++/106131] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
  2022-06-29  2:09 ` [Bug c++/106131] " 18307130172 at fudan dot edu.cn
  2022-06-29  2:36 ` pinskia at gcc dot gnu.org
@ 2022-06-29  9:26 ` redi at gcc dot gnu.org
  2022-06-29 19:20 ` [Bug c++/106131] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-29  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |85811545 at qq dot com

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 106135 has been marked as a duplicate of this bug. ***

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

* [Bug c++/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (2 preceding siblings ...)
  2022-06-29  9:26 ` redi at gcc dot gnu.org
@ 2022-06-29 19:20 ` pinskia at gcc dot gnu.org
  2022-06-29 19:21 ` pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-29 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.2
            Summary|-fstrict-aliasing breaks    |[10/11/12/13 Regression]
                   |normal program that does    |-fstrict-aliasing breaks
                   |not use any pointer or      |normal program that does
                   |reference                   |not use any pointer or
                   |                            |reference
           Keywords|                            |needs-bisection,
                   |                            |needs-reduction

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This feels like a front-end issue ...

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

* [Bug c++/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (3 preceding siblings ...)
  2022-06-29 19:20 ` [Bug c++/106131] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
@ 2022-06-29 19:21 ` pinskia at gcc dot gnu.org
  2022-06-29 19:38 ` mpolacek at gcc dot gnu.org
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-29 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.2                        |10.5

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

* [Bug c++/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (4 preceding siblings ...)
  2022-06-29 19:21 ` pinskia at gcc dot gnu.org
@ 2022-06-29 19:38 ` mpolacek at gcc dot gnu.org
  2022-06-29 19:39 ` [Bug tree-optimization/106131] " mpolacek at gcc dot gnu.org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-29 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with

commit 8403c2cf5f66758fc78a01a675b0d218fded0202
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 24 14:07:18 2014 +0000

    re PR target/63679 ([AArch64] Failure to constant fold.)

    2014-11-24  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/63679
            * tree-ssa-sccvn.c: Include ipa-ref.h, plugin-api.h and cgraph.h.
            (copy_reference_ops_from_ref): Fix non-constant ADDR_EXPR case
            to properly leave off at -1.
            (fully_constant_vn_reference_p): Generalize folding from
            constant initializers.
            (vn_reference_lookup_3): When looking through aggregate copies
            handle offsetted reads and try simplifying the result to
            a constant.
            * gimple-fold.h (fold_ctor_reference): Export.
            * gimple-fold.c (fold_ctor_reference): Likewise.

            * gcc.dg/tree-ssa/ssa-fre-42.c: New testcase.
            * gcc.dg/tree-ssa/20030807-5.c: Avoid folding read from global to
zero.
            * gcc.target/i386/ssetype-1.c: Likewise.
            * gcc.target/i386/ssetype-3.c: Likewise.
            * gcc.target/i386/ssetype-5.c: Likewise.

    From-SVN: r218019

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

* [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (5 preceding siblings ...)
  2022-06-29 19:38 ` mpolacek at gcc dot gnu.org
@ 2022-06-29 19:39 ` mpolacek at gcc dot gnu.org
  2022-06-29 19:39 ` mpolacek at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-29 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
                 CC|                            |mpolacek at gcc dot gnu.org
          Component|c++                         |tree-optimization
           Priority|P3                          |P2

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

* [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (6 preceding siblings ...)
  2022-06-29 19:39 ` [Bug tree-optimization/106131] " mpolacek at gcc dot gnu.org
@ 2022-06-29 19:39 ` mpolacek at gcc dot gnu.org
  2022-06-30  0:50 ` 18307130172 at fudan dot edu.cn
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-29 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-06-29
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

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

* [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (7 preceding siblings ...)
  2022-06-29 19:39 ` mpolacek at gcc dot gnu.org
@ 2022-06-30  0:50 ` 18307130172 at fudan dot edu.cn
  2022-06-30  6:47 ` rguenther at suse dot de
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: 18307130172 at fudan dot edu.cn @ 2022-06-30  0:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Xue Zhenliang <18307130172 at fudan dot edu.cn> ---
I'm trying to reducing it further. Now I've eliminated the dependency on STL:

struct Pair {
    int a, b;

    Pair(const Pair &) = default;
    Pair(int _a, int _b) : a(_a), b(_b) {}
    Pair &operator=(const Pair &z) {
        a = z.a;
        b = z.b;
        return *this;
    }
};

const int &max(const int &a, const int &b) {
    return a < b ? b : a;
}

int foo(Pair x, Pair y) {
    return max(x.b, y.b);
}

int main() {
    auto f = new Pair[3] {{0, -11}, {0, -8}, {0, 2}};
    for (int i = 0; i < 1; i++) {
        f[i] = f[0];
        if(i == 0)
            f[i] = f[2];
        if (foo(f[i], f[1]) != 2)
            __builtin_abort();
    }
}

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

* [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (8 preceding siblings ...)
  2022-06-30  0:50 ` 18307130172 at fudan dot edu.cn
@ 2022-06-30  6:47 ` rguenther at suse dot de
  2022-06-30  7:57 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenther at suse dot de @ 2022-06-30  6:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 29 Jun 2022, mpolacek at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106131
> 
> --- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
> Started with
> 
> commit 8403c2cf5f66758fc78a01a675b0d218fded0202
> Author: Richard Biener <rguenther@suse.de>
> Date:   Mon Nov 24 14:07:18 2014 +0000

I think that just exposed it.  Btw, I've not got to the point 
understanding what actual transform makes the testcase fail (nor
spot the relevant difference in .optimized).

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

* [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (9 preceding siblings ...)
  2022-06-30  6:47 ` rguenther at suse dot de
@ 2022-06-30  7:57 ` rguenth at gcc dot gnu.org
  2022-06-30  8:31 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-30  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the issue seems to be that fre1 transforms

  <bb 3> :
  _1 = (long unsigned int) i_13;
  _2 = _1 * 8;
  _3 = _18 + _2;
  _40 = MEM[(const struct Pair &)_18].a;
  _3->a = _40;
  _44 = MEM[(const struct Pair &)_18].b;
  _3->b = _44;
  if (i_13 == 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  _5 = (long unsigned int) i_13;
  _6 = _5 * 8;
  _7 = _18 + _6;
  _45 = MEM[(const struct Pair &)_18 + 16].a;
  _7->a = _45;
  _46 = MEM[(const struct Pair &)_18 + 16].b;
  _7->b = _46;

  <bb 5> :
  _9 = (long unsigned int) i_13;
  _10 = _9 * 8;
  _11 = _18 + _10;
  x = MEM[(const struct Pair &)_11];
  y = MEM[(const struct Pair &)_18 + 8];
  _47 = MEM[(const int &)&x + 4];
  _48 = MEM[(const int &)&y + 4];
  if (_47 < _48)
    goto <bb 7>; [50.00%]
  else
    goto <bb 6>; [50.00%]

into

...
  <bb 5> :
  x = MEM[(const struct Pair &)_3];
  y = MEM[(const struct Pair &)_18 + 8];
  _48 = MEM[(const int &)&y + 4];
  if (_44 < _48)
    goto <bb 7>; [50.00%]
  else
    goto <bb 6>; [50.00%]

CSEing the load _47 = MEM[(const int &)&x + 4]; to _44 crossing the
conditional clobber in BB4.

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

* [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (10 preceding siblings ...)
  2022-06-30  7:57 ` rguenth at gcc dot gnu.org
@ 2022-06-30  8:31 ` rguenth at gcc dot gnu.org
  2022-07-01  6:53 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-30  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the issue is in processing

  x = MEM[(const struct Pair &)_11];
  _47 = MEM[(const int &)&x + 4];

where we when visiting the def for 'x' continue the lookup with an
effective MEM[(const struct Pair &)_11 + 4]; but that looks for a store
of TBAA 'Pair' where we then correctly determine that _7->b = _46;
doesn't possibly alias.

A conservative fix restoring behavior before the relevant change is to
force alias set zero (no TBAA) for the offsetted lookup.

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

* [Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (11 preceding siblings ...)
  2022-06-30  8:31 ` rguenth at gcc dot gnu.org
@ 2022-07-01  6:53 ` cvs-commit at gcc dot gnu.org
  2022-07-01  6:54 ` [Bug tree-optimization/106131] [10/11/12 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-01  6:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:9701432ff79926a5dd3303be3417e0bd0c24140b

commit r13-1376-g9701432ff79926a5dd3303be3417e0bd0c24140b
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jun 30 10:33:40 2022 +0200

    tree-optimization/106131 - wrong code with FRE rewriting

    The following makes sure to not use the original TBAA type for
    looking up a value across an aggregate copy when we had to offset
    the read.

    2022-06-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/106131
            * tree-ssa-sccvn.cc (vn_reference_lookup_3): Force alias-set
            zero when offsetting the read looking through an aggregate
            copy.

            * g++.dg/torture/pr106131.C: New testcase.

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

* [Bug tree-optimization/106131] [10/11/12 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (12 preceding siblings ...)
  2022-07-01  6:53 ` cvs-commit at gcc dot gnu.org
@ 2022-07-01  6:54 ` rguenth at gcc dot gnu.org
  2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-01  6:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.0
            Summary|[10/11/12/13 Regression]    |[10/11/12 Regression]
                   |-fstrict-aliasing breaks    |-fstrict-aliasing breaks
                   |normal program that does    |normal program that does
                   |not use any pointer or      |not use any pointer or
                   |reference                   |reference

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/106131] [10/11/12 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (13 preceding siblings ...)
  2022-07-01  6:54 ` [Bug tree-optimization/106131] [10/11/12 " rguenth at gcc dot gnu.org
@ 2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
  2022-10-11 13:04 ` [Bug tree-optimization/106131] [10/11 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-19 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:ec9287ba9718871aa64900d6168105802e1ca941

commit r12-8583-gec9287ba9718871aa64900d6168105802e1ca941
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jun 30 10:33:40 2022 +0200

    tree-optimization/106131 - wrong code with FRE rewriting

    The following makes sure to not use the original TBAA type for
    looking up a value across an aggregate copy when we had to offset
    the read.

    2022-06-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/106131
            * tree-ssa-sccvn.cc (vn_reference_lookup_3): Force alias-set
            zero when offsetting the read looking through an aggregate
            copy.

            * g++.dg/torture/pr106131.C: New testcase.

    (cherry picked from commit 9701432ff79926a5dd3303be3417e0bd0c24140b)

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

* [Bug tree-optimization/106131] [10/11 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (14 preceding siblings ...)
  2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
@ 2022-10-11 13:04 ` cvs-commit at gcc dot gnu.org
  2022-10-14 10:47 ` [Bug tree-optimization/106131] [10 " cvs-commit at gcc dot gnu.org
  2022-10-14 10:48 ` rguenth at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-11 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:befa9c8b072ef8b81d4a5b46d83f81cd58318c2b

commit r11-10304-gbefa9c8b072ef8b81d4a5b46d83f81cd58318c2b
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jun 30 10:33:40 2022 +0200

    tree-optimization/106131 - wrong code with FRE rewriting

    The following makes sure to not use the original TBAA type for
    looking up a value across an aggregate copy when we had to offset
    the read.

    2022-06-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/106131
            * tree-ssa-sccvn.c (vn_reference_lookup_3): Force alias-set
            zero when offsetting the read looking through an aggregate
            copy.

            * g++.dg/torture/pr106131.C: New testcase.

    (cherry picked from commit 9701432ff79926a5dd3303be3417e0bd0c24140b)

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

* [Bug tree-optimization/106131] [10 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (15 preceding siblings ...)
  2022-10-11 13:04 ` [Bug tree-optimization/106131] [10/11 " cvs-commit at gcc dot gnu.org
@ 2022-10-14 10:47 ` cvs-commit at gcc dot gnu.org
  2022-10-14 10:48 ` rguenth at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-14 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:a8abbf6d15fefe5ac27aa7c21201883b66cc9b01

commit r10-11036-ga8abbf6d15fefe5ac27aa7c21201883b66cc9b01
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jun 30 10:33:40 2022 +0200

    tree-optimization/106131 - wrong code with FRE rewriting

    The following makes sure to not use the original TBAA type for
    looking up a value across an aggregate copy when we had to offset
    the read.

    2022-06-30  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/106131
            * tree-ssa-sccvn.c (vn_reference_lookup_3): Force alias-set
            zero when offsetting the read looking through an aggregate
            copy.

            * g++.dg/torture/pr106131.C: New testcase.

    (cherry picked from commit 9701432ff79926a5dd3303be3417e0bd0c24140b)

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

* [Bug tree-optimization/106131] [10 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference
  2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
                   ` (16 preceding siblings ...)
  2022-10-14 10:47 ` [Bug tree-optimization/106131] [10 " cvs-commit at gcc dot gnu.org
@ 2022-10-14 10:48 ` rguenth at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-14 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |10.4.1
         Resolution|---                         |FIXED
      Known to fail|                            |10.4.0

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-10-14 10:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29  2:05 [Bug c++/106131] New: -fstrict-aliasing breaks normal program that does not use any pointer or reference 18307130172 at fudan dot edu.cn
2022-06-29  2:09 ` [Bug c++/106131] " 18307130172 at fudan dot edu.cn
2022-06-29  2:36 ` pinskia at gcc dot gnu.org
2022-06-29  9:26 ` redi at gcc dot gnu.org
2022-06-29 19:20 ` [Bug c++/106131] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-06-29 19:21 ` pinskia at gcc dot gnu.org
2022-06-29 19:38 ` mpolacek at gcc dot gnu.org
2022-06-29 19:39 ` [Bug tree-optimization/106131] " mpolacek at gcc dot gnu.org
2022-06-29 19:39 ` mpolacek at gcc dot gnu.org
2022-06-30  0:50 ` 18307130172 at fudan dot edu.cn
2022-06-30  6:47 ` rguenther at suse dot de
2022-06-30  7:57 ` rguenth at gcc dot gnu.org
2022-06-30  8:31 ` rguenth at gcc dot gnu.org
2022-07-01  6:53 ` cvs-commit at gcc dot gnu.org
2022-07-01  6:54 ` [Bug tree-optimization/106131] [10/11/12 " rguenth at gcc dot gnu.org
2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
2022-10-11 13:04 ` [Bug tree-optimization/106131] [10/11 " cvs-commit at gcc dot gnu.org
2022-10-14 10:47 ` [Bug tree-optimization/106131] [10 " cvs-commit at gcc dot gnu.org
2022-10-14 10:48 ` rguenth 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).