public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/92023] [9/10/11/12 Regression] Miscompilation when inlining operator delete[]
       [not found] <bug-92023-4@http.gcc.gnu.org/bugzilla/>
@ 2021-11-12  8:37 ` pinskia at gcc dot gnu.org
  2021-11-12  9:09 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-12  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |middle-end
      Known to fail|                            |11.2.0, 7.1.0
            Summary|Miscompilation when         |[9/10/11/12 Regression]
                   |inlining operator delete[]  |Miscompilation when
                   |                            |inlining operator delete[]
      Known to work|                            |6.4.0
   Target Milestone|---                         |9.5

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
here is a runtime testcase:
#include <cstddef>
#include <cstdio>
#include <new>

int t = 0;
void use(int* p) __attribute__((noipa,noinline,noclone));
void use(int*){}
void report(int) __attribute__((noipa,noinline,noclone));
void report(int a)
{printf("%d\n",a);t++;}

const int N = 5;
const size_t S = 512;

char objs[N][S];
bool taken[N] = {};

void* operator new[](size_t size) {
    if (size <= S) {
        for (int i = 0; i < N; i++) {
            if (!taken[i]) {
                report(2000 + i);
                taken[i] = true;
                return &objs[i];
            }
        }
    }
    throw std::bad_alloc();
}

void operator delete[](void* ptr) noexcept {
    for (int i = 0; i < N; i++) {
        if (ptr == &objs[i]) {
            report(-2000 - i);
            taken[i] = false;
        }
    }
}

int n = 10;
void test() __attribute__((noinline));
void test() {
    int* a = new int[n];
    int* b = new int[n];
    use(a);
    use(b);
    delete[] b;
    delete[] a;
}

int main(void)
{
    test();
    if (t != 4)
      __builtin_abort();
}

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

* [Bug middle-end/92023] [9/10/11/12 Regression] Miscompilation when inlining operator delete[]
       [not found] <bug-92023-4@http.gcc.gnu.org/bugzilla/>
  2021-11-12  8:37 ` [Bug middle-end/92023] [9/10/11/12 Regression] Miscompilation when inlining operator delete[] pinskia at gcc dot gnu.org
@ 2021-11-12  9:09 ` rguenth at gcc dot gnu.org
  2022-05-27  9:41 ` [Bug middle-end/92023] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-12  9:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug middle-end/92023] [10/11/12/13 Regression] Miscompilation when inlining operator delete[]
       [not found] <bug-92023-4@http.gcc.gnu.org/bugzilla/>
  2021-11-12  8:37 ` [Bug middle-end/92023] [9/10/11/12 Regression] Miscompilation when inlining operator delete[] pinskia at gcc dot gnu.org
  2021-11-12  9:09 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:41 ` rguenth at gcc dot gnu.org
  2022-06-28 10:38 ` jakub at gcc dot gnu.org
  2023-07-07 10:36 ` [Bug middle-end/92023] [11/12/13/14 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug middle-end/92023] [10/11/12/13 Regression] Miscompilation when inlining operator delete[]
       [not found] <bug-92023-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-05-27  9:41 ` [Bug middle-end/92023] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:38 ` jakub at gcc dot gnu.org
  2023-07-07 10:36 ` [Bug middle-end/92023] [11/12/13/14 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug middle-end/92023] [11/12/13/14 Regression] Miscompilation when inlining operator delete[]
       [not found] <bug-92023-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-06-28 10:38 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:36 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-92023-4@http.gcc.gnu.org/bugzilla/>
2021-11-12  8:37 ` [Bug middle-end/92023] [9/10/11/12 Regression] Miscompilation when inlining operator delete[] pinskia at gcc dot gnu.org
2021-11-12  9:09 ` rguenth at gcc dot gnu.org
2022-05-27  9:41 ` [Bug middle-end/92023] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:38 ` jakub at gcc dot gnu.org
2023-07-07 10:36 ` [Bug middle-end/92023] [11/12/13/14 " 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).