public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/92879] [10 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization
       [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-09 16:39 ` jakub at gcc dot gnu.org
  2020-05-07 11:56 ` [Bug tree-optimization/92879] [10/11 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-09 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The placement new is inlined at this point, the operator new that remains is
replaceable and because a is a global variable, its address needs to be
considered escaped.
While access to not yet fully constructed var from another TU might be
problematic, in what the restrict pass we actually don't know (unless we look
at abstract origin and prove there is no post-ctor code in between) it is a
ctor which would have such restrictions.

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

* [Bug tree-optimization/92879] [10/11 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization
       [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
  2020-03-09 16:39 ` [Bug tree-optimization/92879] [10 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization jakub at gcc dot gnu.org
@ 2020-05-07 11:56 ` jakub at gcc dot gnu.org
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-07 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.1 has been released.

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

* [Bug tree-optimization/92879] [10/11 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization
       [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
  2020-03-09 16:39 ` [Bug tree-optimization/92879] [10 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization jakub at gcc dot gnu.org
  2020-05-07 11:56 ` [Bug tree-optimization/92879] [10/11 " jakub at gcc dot gnu.org
@ 2020-07-23  6:51 ` rguenth at gcc dot gnu.org
  2021-02-10 21:36 ` msebor at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ 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=92879

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

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

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

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

* [Bug tree-optimization/92879] [10/11 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization
       [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
@ 2021-02-10 21:36 ` msebor at gcc dot gnu.org
  2021-02-10 21:43 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-02-10 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
      Known to work|                            |11.0
             Status|NEW                         |RESOLVED

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
The warning has disappeared with r11-4745.  GCC now emits the following code:

;; Function _GLOBAL__sub_I_a (_GLOBAL__sub_I_a, funcdef_no=5, decl_uid=2418,
cgraph_uid=6, symbol_order=6) (executed once)

void _GLOBAL__sub_I_a ()
{
  int i;
  void * _5;

  <bb 2> [local count: 1073741824]:
  MEM[(struct __as_base  &)&a] ={v} {CLOBBER};
  a.m = 0;
  _5 = operator new [] (0);
  a.p = _5;
  return;

}

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

* [Bug tree-optimization/92879] [10/11 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization
       [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-02-10 21:36 ` msebor at gcc dot gnu.org
@ 2021-02-10 21:43 ` cvs-commit at gcc dot gnu.org
  2021-11-10 20:44 ` sandra at gcc dot gnu.org
  2021-11-10 21:51 ` msebor at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-10 21:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:21c6ad7a12fecc4c85ac26289d9096379b550585

commit r11-7180-g21c6ad7a12fecc4c85ac26289d9096379b550585
Author: Martin Sebor <msebor@redhat.com>
Date:   Wed Feb 10 14:42:22 2021 -0700

    Add test for PR tree-optimization/92879.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/92879
            * g++.dg/warn/Warray-bounds-16.C: New test.

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

* [Bug tree-optimization/92879] [10/11 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization
       [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-02-10 21:43 ` cvs-commit at gcc dot gnu.org
@ 2021-11-10 20:44 ` sandra at gcc dot gnu.org
  2021-11-10 21:51 ` msebor at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: sandra at gcc dot gnu.org @ 2021-11-10 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

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

--- Comment #11 from sandra at gcc dot gnu.org ---
The new testcase is failing on nios2-elf.

$ nios2-elf-g++  src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C
-O2 -fdump-tree-optimized -S -Wall
In constructor 'S::S(int)',
    inlined from 'void __static_initialization_and_destruction_0(int, int)' at
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:26:7,
    inlined from '(static initializers for
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C)' at
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:26:8:
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:22:7: warning:
array subscript [0, 536870911] is outside array bounds of 'void [0]'
[-Warray-bounds]
   22 |       new (p + i) int ();
      |       ^~~~~~~~~~~~~~~~~~
src/gcc-mainline/gcc/testsuite/g++.dg/warn/Warray-bounds-16.C:19:51: note:
object of size 0 allocated by 'operator new []'
   19 |     p = (int*) new unsigned char [sizeof (int) * m];
      |                                                   ^


This is what I see in the .optimized dump file:

;; Function _GLOBAL__sub_I_a (_GLOBAL__sub_I_a, funcdef_no=5, decl_uid=1975,
cgraph_uid=6, symbol_order=6) (executed once)

Removing basic block 5
void _GLOBAL__sub_I_a ()
{
  int _2;
  void * _5;
  sizetype _12;
  sizetype _20;

  <bb 2> [local count: 1073741824]:
  a ={v} {CLOBBER};
  a.m = 0;
  _5 = operator new [] (0);
  a.p = _5;
  _2 = a.m;
  if (_2 > 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 3> [local count: 955630224]:
  _20 = (sizetype) _2;
  _12 = _20 * 4;
  __builtin_memset (_5, 0, _12); [tail call]

  <bb 4> [local count: 1073741825]:
  return;

}

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

* [Bug tree-optimization/92879] [10/11 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization
       [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-11-10 20:44 ` sandra at gcc dot gnu.org
@ 2021-11-10 21:51 ` msebor at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-11-10 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> ---
The test fails everywhere.  It regressed with r12-5107 (see pr102690).  The
solution was to xfail it (to your point in pr101674).

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-92879-4@http.gcc.gnu.org/bugzilla/>
2020-03-09 16:39 ` [Bug tree-optimization/92879] [10 Regression] incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization jakub at gcc dot gnu.org
2020-05-07 11:56 ` [Bug tree-optimization/92879] [10/11 " jakub at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2021-02-10 21:36 ` msebor at gcc dot gnu.org
2021-02-10 21:43 ` cvs-commit at gcc dot gnu.org
2021-11-10 20:44 ` sandra at gcc dot gnu.org
2021-11-10 21:51 ` msebor 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).