public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98413] New: ICE with placement new
@ 2020-12-21 15:14 475647575 at qq dot com
  2020-12-21 15:23 ` [Bug c++/98413] " 475647575 at qq dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: 475647575 at qq dot com @ 2020-12-21 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98413
           Summary: ICE with placement new
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 475647575 at qq dot com
  Target Milestone: ---

// example program
#include <new>
struct A{
    int m{};
};
template<class T>
void f(A *instance, T A::*member_pointer)
{
    new (&(instance->*member_pointer)) T{0};
}

int main()
{
    A a;
    f(&a, &A::m);
    return 0;
}
-----------------------------------
error: 

<source>: In instantiation of 'void f(A*, T A::*) [with T = int]':
<source>:14:16:   required from here
<source>:8:5: internal compiler error: tree check: expected integer_type or
enumeral_type or boolean_type or real_type or fixed_point_type, have
offset_type in get_offset_range, at builtins.c:5108
    8 |     new (&(instance->*member_pointer)) T{0};
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x1cb9849 internal_error(char const*, ...)
        ???:0
0x673fd7 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xabc5d8 compute_objsize(tree_node*, int, access_ref*, range_query*)
        ???:0
0x7ee121 build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int)
        ???:0
0x90fa2f instantiate_decl(tree_node*, bool, bool)
        ???:0
0x950f5b instantiate_pending_templates(int)
        ???:0
0x7c21b9 c_parse_final_cleanups()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 1

------------------------------------
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/gcc11/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --disable-multilib --prefix=/gcc11
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201217 (experimental) (GCC)
-------------------------------------
exact gcc commit used:
https://github.com/gcc-mirror/gcc/commit/6f8486523f61bf0aa476dfa4197d1e3b71a0a8f3

This bug can be re-producted in godbolt:
https://godbolt.org/z/TeTbET

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

* [Bug c++/98413] ICE with placement new
  2020-12-21 15:14 [Bug c++/98413] New: ICE with placement new 475647575 at qq dot com
@ 2020-12-21 15:23 ` 475647575 at qq dot com
  2020-12-21 15:30 ` [Bug c++/98413] [11 Regression] ICE with placement new since r11-3827-g83685efd5fd1623c marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: 475647575 at qq dot com @ 2020-12-21 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from 欢乐的0403 <475647575 at qq dot com> ---
// A smaller example:
#include <new>
struct A{
    int m;
};

A a;
void f(int A::*member_pointer)
{
    new (&(a.*member_pointer)) int;
}
//https://godbolt.org/z/KhPq9e

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

* [Bug c++/98413] [11 Regression] ICE with placement new since r11-3827-g83685efd5fd1623c
  2020-12-21 15:14 [Bug c++/98413] New: ICE with placement new 475647575 at qq dot com
  2020-12-21 15:23 ` [Bug c++/98413] " 475647575 at qq dot com
@ 2020-12-21 15:30 ` marxin at gcc dot gnu.org
  2020-12-23  0:28 ` msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-21 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE with placement new      |[11 Regression] ICE with
                   |                            |placement new since
                   |                            |r11-3827-g83685efd5fd1623c
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
           Priority|P3                          |P1
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-12-21
      Known to work|                            |10.2.0
      Known to fail|                            |11.0

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-3827-g83685efd5fd1623c.

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

* [Bug c++/98413] [11 Regression] ICE with placement new since r11-3827-g83685efd5fd1623c
  2020-12-21 15:14 [Bug c++/98413] New: ICE with placement new 475647575 at qq dot com
  2020-12-21 15:23 ` [Bug c++/98413] " 475647575 at qq dot com
  2020-12-21 15:30 ` [Bug c++/98413] [11 Regression] ICE with placement new since r11-3827-g83685efd5fd1623c marxin at gcc dot gnu.org
@ 2020-12-23  0:28 ` msebor at gcc dot gnu.org
  2020-12-23 23:38 ` cvs-commit at gcc dot gnu.org
  2020-12-23 23:50 ` [Bug c++/98413] [11 Regression] ICE on placement new and member pointer msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-12-23  0:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           Keywords|                            |ice-on-valid-code

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

* [Bug c++/98413] [11 Regression] ICE with placement new since r11-3827-g83685efd5fd1623c
  2020-12-21 15:14 [Bug c++/98413] New: ICE with placement new 475647575 at qq dot com
                   ` (2 preceding siblings ...)
  2020-12-23  0:28 ` msebor at gcc dot gnu.org
@ 2020-12-23 23:38 ` cvs-commit at gcc dot gnu.org
  2020-12-23 23:50 ` [Bug c++/98413] [11 Regression] ICE on placement new and member pointer msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-23 23:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:fdd8560cce9f10fe5dcd26483440be136b81701d

commit r11-6328-gfdd8560cce9f10fe5dcd26483440be136b81701d
Author: Martin Sebor <msebor@redhat.com>
Date:   Wed Dec 23 16:28:06 2020 -0700

    PR c++/98413 - ICE on placement new and member pointer

    gcc/ChangeLog:

            PR c++/98413
            * builtins.c (get_offset_range): Avoid non-integers/-pointers.

    gcc/testsuite/ChangeLog:

            PR c++/98413
            * g++.dg/warn/pr98413.C: New test.

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

* [Bug c++/98413] [11 Regression] ICE on placement new and member pointer
  2020-12-21 15:14 [Bug c++/98413] New: ICE with placement new 475647575 at qq dot com
                   ` (3 preceding siblings ...)
  2020-12-23 23:38 ` cvs-commit at gcc dot gnu.org
@ 2020-12-23 23:50 ` msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-12-23 23:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
            Summary|[11 Regression] ICE with    |[11 Regression] ICE on
                   |placement new since         |placement new and member
                   |r11-3827-g83685efd5fd1623c  |pointer
         Resolution|---                         |FIXED

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in r11-6328.

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

end of thread, other threads:[~2020-12-23 23:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 15:14 [Bug c++/98413] New: ICE with placement new 475647575 at qq dot com
2020-12-21 15:23 ` [Bug c++/98413] " 475647575 at qq dot com
2020-12-21 15:30 ` [Bug c++/98413] [11 Regression] ICE with placement new since r11-3827-g83685efd5fd1623c marxin at gcc dot gnu.org
2020-12-23  0:28 ` msebor at gcc dot gnu.org
2020-12-23 23:38 ` cvs-commit at gcc dot gnu.org
2020-12-23 23:50 ` [Bug c++/98413] [11 Regression] ICE on placement new and member pointer 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).