public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102216] New: False positive warray-bounds with -O2
@ 2021-09-06 10:14 vries at gcc dot gnu.org
  2021-09-06 10:45 ` [Bug tree-optimization/102216] " pinskia at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-06 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102216
           Summary: False positive warray-bounds with -O2
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

With a gcc build from commit 637dfcf43cf, I run into an incorrect Warray-bounds
(which causes a buildbreaker when building gdb, as reported here:
https://sourceware.org/pipermail/gdb/2021-September/049687.html ).

Reproducer minimized from gdb/language.c:
...
$ cat language.c
#include <algorithm>

static inline bool
compare_cstrings (const char *str1, const char *str2)
{
  return str1 < str2;
}

void
add_set_language_command ()
{
  static const char **language_names;

  language_names = new const char *[6];

  language_names[0] = "auto";
  language_names[1] = "local";
  language_names[2] = "unknown";

  const char **language_names_p = language_names;
  /* language_names_p == &language_names[0].  */
  language_names_p++;
  /* language_names_p == &language_names[1].  */
  language_names_p++;
  /* language_names_p == &language_names[2].  */
  language_names_p++;
  /* language_names_p == &language_names[3].  */

  const char **sort_begin;

  if (0)
    sort_begin = &language_names[3];
  else
    sort_begin = language_names_p;

  language_names[3] = "";
  language_names[4] = "";
  language_names[5] = nullptr;

  std::sort (sort_begin, &language_names[5], compare_cstrings);
}
...

First with gcc-11:
...
$ g++-11 -x c++ -Werror -Wall -O2 -S language.c -Warray-bounds=1
$ 
...

Now with trunk:
...
$ g++ -x c++ -Werror -Wall -O2 -S language.c -Warray-bounds=1 
In file included from
/home/vries/gcc_versions/devel/install/include/c++/12.0.0/algorithm:61,
                 from language.c:1:
In function ‘void std::__final_insertion_sort(_RandomAccessIterator,
_RandomAccessIterator, _Compare) [with _RandomAccessIterator = const char**;
_Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const char*, const
char*)>]’,
    inlined from ‘void std::__sort(_RandomAccessIterator,
_RandomAccessIterator, _Compare) [with _RandomAccessIterator = const char**;
_Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const char*, const
char*)>]’ at
/home/vries/gcc_versions/devel/install/include/c++/12.0.0/bits/stl_algo.h:1960:31,
    inlined from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter =
const char**; _Compare = bool (*)(const char*, const char*)]’ at
/home/vries/gcc_versions/devel/install/include/c++/12.0.0/bits/stl_algo.h:4868:18,
    inlined from ‘void add_set_language_command()’ at language.c:40:13:
/home/vries/gcc_versions/devel/install/include/c++/12.0.0/bits/stl_algo.h:1869:32:
error: array subscript 19 is outside array bounds of ‘void [48]’
[-Werror=array-bounds]
 1869 |           std::__insertion_sort(__first, __first + int(_S_threshold),
__comp);
      |          
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
language.c: In function ‘void add_set_language_command()’:
language.c:14:38: note: at offset 152 into object of size 48 allocated by
‘operator new []’
   14 |   language_names = new const char *[6];
      |                                      ^
cc1plus: all warnings being treated as errors
...

Now set 'if (0)' to 'if (1)':
...
$ g++ -x c++ -Werror -Wall -O2 -S language.c -Warray-bounds=1 
$
...

So either the warning is incorrect (for this fairly trivial example), or
there's a compiler/std::sort bug and the warning is letting us known.

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

* [Bug tree-optimization/102216] False positive warray-bounds with -O2
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
@ 2021-09-06 10:45 ` pinskia at gcc dot gnu.org
  2021-09-06 20:46 ` pinskia at gcc dot gnu.org
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-06 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-09-06
                 CC|                            |pinskia at gcc dot gnu.org
           Keywords|                            |diagnostic,
                   |                            |missed-optimization

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The problem is dead code:
  language_names_p_9 = &MEM <const char *> [(void *)_4 + 24B];
  MEM[(const char * *)_4 + 24B] = "";
  MEM[(const char * *)_4 + 32B] = "";
  MEM[(const char * *)_4 + 40B] = 0B;
  _2 = _4 + 40;
  D.50907._M_comp = compare_cstrings;
  __comp = D.50907;
  if (_2 != language_names_p_9)
    goto <bb 3>; [53.47%]
  else
    goto <bb 12>; [46.53%]

  <bb 3> [local count: 574129759]:
  _15 = _2 - language_names_p_9;
  _16 = _15 /[ex] 8;

...
 _22 = _2 - language_names_p_9;
  if (_22 > 128)
    goto <bb 4>; [50.00%]
  else
    goto <bb 10>; [50.00%]

  <bb 4> [local count: 287064879]:
  _23 = &MEM <const char *> [(void *)_4 + 152B];
  std::__insertion_sort<const char**, __gnu_cxx::__ops::_Iter_comp_iter<bool
(*)(const char*, const char*)> > (language_names_p_9, _23, __comp);
  __comp_24 = MEM[(struct _Iter_comp_iter *)&__comp];
  goto <bb 9>; [100.00%]

That is _22 (and _15) should be 16.

I just fixed a similar issue today (but the patch did not fix this case).
I will look into fixing this one tomorrow.

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

* [Bug tree-optimization/102216] False positive warray-bounds with -O2
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
  2021-09-06 10:45 ` [Bug tree-optimization/102216] " pinskia at gcc dot gnu.org
@ 2021-09-06 20:46 ` pinskia at gcc dot gnu.org
  2021-09-07  1:32 ` [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-06 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> The problem is dead code:
>   language_names_p_9 = &MEM <const char *> [(void *)_4 + 24B];
>   MEM[(const char * *)_4 + 24B] = "";
>   MEM[(const char * *)_4 + 32B] = "";
>   MEM[(const char * *)_4 + 40B] = 0B;
>   _2 = _4 + 40;
>   D.50907._M_comp = compare_cstrings;
>   __comp = D.50907;
>   if (_2 != language_names_p_9)
>     goto <bb 3>; [53.47%]
>   else
>     goto <bb 12>; [46.53%]
> 
>   <bb 3> [local count: 574129759]:
>   _15 = _2 - language_names_p_9;
>   _16 = _15 /[ex] 8;
> 
> ...
>  _22 = _2 - language_names_p_9;


I have a (hack) patch which removes the first if statement but still does not
fold _15 and _22.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
  2021-09-06 10:45 ` [Bug tree-optimization/102216] " pinskia at gcc dot gnu.org
  2021-09-06 20:46 ` pinskia at gcc dot gnu.org
@ 2021-09-07  1:32 ` pinskia at gcc dot gnu.org
  2021-09-07  1:47 ` pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-07  1:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|False positive              |[12 Regression] missed
                   |warray-bounds with -O2      |optimization causing
                   |                            |Warray-bounds
   Target Milestone|---                         |12.0
      Known to work|                            |4.4.7

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a short testcase:
int
add_set_language_command ()
{
  const char **language_names;

  language_names = new const char *[6];

  const char **language_names_p = language_names;

  language_names_p++;
  language_names_p++;
  language_names_p++;

  return (language_names_p) - (language_names+3);
}

This should just return 0; Which was able to be done in GCC 4.4.7.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-09-07  1:32 ` [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds pinskia at gcc dot gnu.org
@ 2021-09-07  1:47 ` pinskia at gcc dot gnu.org
  2021-09-07  6:31 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-07  1:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |TREE

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So how 4.4.x got the right answer at the tree level was just by accident
really.  VRP used SCEV which basically does a combine.  Forwprop never happened
of PointerPlus until 4.6.  4.5 removed the SCEV usage in VRP and removed the
optimization ...

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-09-07  1:47 ` pinskia at gcc dot gnu.org
@ 2021-09-07  6:31 ` pinskia at gcc dot gnu.org
  2021-09-07  7:21 ` pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-07  6:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think I have a patch which disables the proping in forwprop that creates the
&MEM stuff (it is done still by forwprop just not in this location and via
match instead). The waring is now gone and the code looks better too.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-09-07  6:31 ` pinskia at gcc dot gnu.org
@ 2021-09-07  7:21 ` pinskia at gcc dot gnu.org
  2021-09-07 18:50 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-07  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 51420
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51420&action=edit
Patch which I am testing.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-09-07  7:21 ` pinskia at gcc dot gnu.org
@ 2021-09-07 18:50 ` pinskia at gcc dot gnu.org
  2021-09-07 21:37 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-07 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #6)
> Created attachment 51420 [details]
> Patch which I am testing.

Note I am throwing this patch away and started to rewrite parts of
tree-ssa-forwprop.c instead.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-09-07 18:50 ` pinskia at gcc dot gnu.org
@ 2021-09-07 21:37 ` pinskia at gcc dot gnu.org
  2021-09-15 16:40 ` msebor at gcc dot gnu.org
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-07 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #51420|0                           |1
        is obsolete|                            |

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 51424
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51424&action=edit
New patch

THis is the new patch which I am testing.  It fixes the original issue in
forwprop but does not fix the FIXME of creating extra trees.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-09-07 21:37 ` pinskia at gcc dot gnu.org
@ 2021-09-15 16:40 ` msebor at gcc dot gnu.org
  2021-09-15 19:19 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-09-15 16:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102216
Bug 102216 depends on bug 102238, which changed state.

Bug 102238 Summary: alias_offset in gimple-ssa-sprintf.c is broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102238

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-09-15 16:40 ` msebor at gcc dot gnu.org
@ 2021-09-15 19:19 ` pinskia at gcc dot gnu.org
  2021-10-27  9:28 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-15 19:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102216
Bug 102216 depends on bug 102238, which changed state.

Bug 102238 Summary: alias_offset in gimple-ssa-sprintf.c is broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102238

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-09-15 19:19 ` pinskia at gcc dot gnu.org
@ 2021-10-27  9:28 ` pinskia at gcc dot gnu.org
  2021-11-23  0:50 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-27  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2021-October
                   |                            |/582684.html

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582684.html

Now that PR 102238 is fixed.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2021-10-27  9:28 ` pinskia at gcc dot gnu.org
@ 2021-11-23  0:50 ` pinskia at gcc dot gnu.org
  2021-11-23  1:31 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-23  0:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #51424|0                           |1
        is obsolete|                            |

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 51850
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51850&action=edit
Updated patch

Updated patch based on the feedback, still need to add back the testcase
though.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2021-11-23  0:50 ` pinskia at gcc dot gnu.org
@ 2021-11-23  1:31 ` pinskia at gcc dot gnu.org
  2021-11-23  5:30 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-23  1:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #10)
> Created attachment 51850 [details]
> Updated patch

Note this patch is broken but I have the corrected patch which I am testing
now.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2021-11-23  1:31 ` pinskia at gcc dot gnu.org
@ 2021-11-23  5:30 ` pinskia at gcc dot gnu.org
  2021-11-23  8:45 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-23  5:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|https://gcc.gnu.org/piperma |https://gcc.gnu.org/piperma
                   |il/gcc-patches/2021-October |il/gcc-patches/2021-Novembe
                   |/582684.html                |r/585194.html

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
New patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585194.html

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2021-11-23  5:30 ` pinskia at gcc dot gnu.org
@ 2021-11-23  8:45 ` pinskia at gcc dot gnu.org
  2021-11-23  9:57 ` cvs-commit at gcc dot gnu.org
  2021-11-23 10:01 ` pinskia at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-23  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103377 has been marked as a duplicate of this bug. ***

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2021-11-23  8:45 ` pinskia at gcc dot gnu.org
@ 2021-11-23  9:57 ` cvs-commit at gcc dot gnu.org
  2021-11-23 10:01 ` pinskia at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23  9:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:911b633803dcbb298c98777e29fd260834c0d04a

commit r12-5465-g911b633803dcbb298c98777e29fd260834c0d04a
Author: Andrew Pinski <apinski@marvell.com>
Date:   Tue Nov 23 01:08:55 2021 +0000

    Canonicalize &MEM[ssa_n, CST] to ssa_n p+ CST in fold_stmt_1

    This is a new version of the patch to fix PR 102216.
    Instead of doing the canonicalization inside forwprop, Richi
    mentioned we should do it inside fold_stmt_1 and that is what
    this patch does.

            PR tree-optimization/102216

    gcc/ChangeLog:

            * gimple-fold.c (fold_stmt_1): Add canonicalization
            of "&MEM[ssa_n, CST]" to "ssa_n p+ CST", note this
            can only be done if !in_place.

    gcc/testsuite/ChangeLog:

            * g++.dg/tree-ssa/pr102216-1.C: New test.
            * g++.dg/tree-ssa/pr102216-2.C: New test.

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

* [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds
  2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2021-11-23  9:57 ` cvs-commit at gcc dot gnu.org
@ 2021-11-23 10:01 ` pinskia at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-23 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-11-23 10:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 10:14 [Bug tree-optimization/102216] New: False positive warray-bounds with -O2 vries at gcc dot gnu.org
2021-09-06 10:45 ` [Bug tree-optimization/102216] " pinskia at gcc dot gnu.org
2021-09-06 20:46 ` pinskia at gcc dot gnu.org
2021-09-07  1:32 ` [Bug tree-optimization/102216] [12 Regression] missed optimization causing Warray-bounds pinskia at gcc dot gnu.org
2021-09-07  1:47 ` pinskia at gcc dot gnu.org
2021-09-07  6:31 ` pinskia at gcc dot gnu.org
2021-09-07  7:21 ` pinskia at gcc dot gnu.org
2021-09-07 18:50 ` pinskia at gcc dot gnu.org
2021-09-07 21:37 ` pinskia at gcc dot gnu.org
2021-09-15 16:40 ` msebor at gcc dot gnu.org
2021-09-15 19:19 ` pinskia at gcc dot gnu.org
2021-10-27  9:28 ` pinskia at gcc dot gnu.org
2021-11-23  0:50 ` pinskia at gcc dot gnu.org
2021-11-23  1:31 ` pinskia at gcc dot gnu.org
2021-11-23  5:30 ` pinskia at gcc dot gnu.org
2021-11-23  8:45 ` pinskia at gcc dot gnu.org
2021-11-23  9:57 ` cvs-commit at gcc dot gnu.org
2021-11-23 10:01 ` pinskia 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).