public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102071] New: crash when combining -faligned-new=N with array cookie
@ 2021-08-26  0:05 richard-gccbugzilla at metafoo dot co.uk
  2021-08-26  8:00 ` [Bug c++/102071] " marxin at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2021-08-26  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102071
           Summary: crash when combining -faligned-new=N with array cookie
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk
  Target Milestone: ---

Testcase:

struct X { ~X(); int c; };
extern int n;
X *p = new X[n];


Compiling with -faligned-new=2 gives:

<source>:3:15: internal compiler error: tree check: expected class 'vl_exp',
have 'unary' (nop_expr) in stabilize_call, at cp/tree.c:5739
    3 | X *p = new X[n];
      |               ^
0x1f2c1d9 internal_error(char const*, ...)
        ???:0
0x6baa59 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ???:0
0xab0d8d stabilize_call(tree_node*, tree_node**)
        ???:0
0x8e0551 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
0x9cffc5 c_parse_file()
        ???:0
0xb55092 c_common_parse_file()
        ???:0


FWIW, for this example, Clang passes align_val_t{max(alignof(size_t),
alignof(X))} as the alignment argument to ensure the cookie is suitably
aligned.

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

end of thread, other threads:[~2022-05-12 21:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26  0:05 [Bug c++/102071] New: crash when combining -faligned-new=N with array cookie richard-gccbugzilla at metafoo dot co.uk
2021-08-26  8:00 ` [Bug c++/102071] " marxin at gcc dot gnu.org
2021-08-26  8:00 ` marxin at gcc dot gnu.org
2021-08-26  9:06 ` redi at gcc dot gnu.org
2021-08-26  9:08 ` marxin at gcc dot gnu.org
2021-08-26  9:09 ` [Bug c++/102071] [10/11/12 Regression] " redi at gcc dot gnu.org
2021-09-19 23:15 ` pinskia at gcc dot gnu.org
2022-01-17 13:53 ` rguenth at gcc dot gnu.org
2022-03-27 16:58 ` jason at gcc dot gnu.org
2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
2022-04-12 21:08 ` [Bug c++/102071] [10/11 " cvs-commit at gcc dot gnu.org
2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
2022-05-12 21:24 ` [Bug c++/102071] [10 " cvs-commit at gcc dot gnu.org
2022-05-12 21:29 ` jason 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).