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
* [Bug c++/102071] crash when combining -faligned-new=N with array cookie
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 ` marxin at gcc dot gnu.org
2021-08-26 8:00 ` marxin at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-26 8:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Cannot reproduce it with g++ pr102071.C -c -faligned-new=2
g++ --version
g++ (GCC) 12.0.0 20210826 (experimental)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] crash when combining -faligned-new=N with array cookie
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
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-26 8:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Ever confirmed|0 |1
Last reconfirmed| |2021-08-26
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] crash when combining -faligned-new=N with array cookie
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
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-26 9:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It crashes if you add -std=gnu++20
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] crash when combining -faligned-new=N with array cookie
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
` (2 preceding siblings ...)
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
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-26 9:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Then it started with r10-3661-g8e007055dd1374ca.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10/11/12 Regression] crash when combining -faligned-new=N with array cookie
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
` (3 preceding siblings ...)
2021-08-26 9:08 ` marxin at gcc dot gnu.org
@ 2021-08-26 9:09 ` redi at gcc dot gnu.org
2021-09-19 23:15 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-26 9:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.3.1, 11.2.1, 12.0
Known to work| |9.4.1
Summary|crash when combining |[10/11/12 Regression] crash
|-faligned-new=N with array |when combining
|cookie |-faligned-new=N with array
| |cookie
Keywords| |ice-on-valid-code
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Started to ICE with r276622 "PR c++/91369 - Implement P0784R7: constexpr new"
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10/11/12 Regression] crash when combining -faligned-new=N with array cookie
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
` (4 preceding siblings ...)
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
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-19 23:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10/11/12 Regression] crash when combining -faligned-new=N with array cookie
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
` (5 preceding siblings ...)
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
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 13:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10/11/12 Regression] crash when combining -faligned-new=N with array cookie
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
` (6 preceding siblings ...)
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
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2022-03-27 16:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10/11/12 Regression] crash when combining -faligned-new=N with array cookie
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
` (7 preceding siblings ...)
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
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-28 13:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:19b87a06482756739087283cd8b884cb3de693f9
commit r12-7855-g19b87a06482756739087283cd8b884cb3de693f9
Author: Jason Merrill <jason@redhat.com>
Date: Sun Mar 27 12:36:13 2022 -0400
c++: low -faligned-new [PR102071]
This test ICEd after the constexpr new patch (r10-3661) because alloc_call
had a NOP_EXPR around it; fixed by moving the NOP_EXPR to alloc_expr. And
the PR pointed out that the size_t cookie might need more alignment, so I
fix that as well.
PR c++/102071
gcc/cp/ChangeLog:
* init.cc (build_new_1): Include cookie in alignment. Omit
constexpr wrapper from alloc_call.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/aligned-new9.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10/11 Regression] crash when combining -faligned-new=N with array cookie
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
` (8 preceding siblings ...)
2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 21:08 ` cvs-commit at gcc dot gnu.org
2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-12 21:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:164c6a1c5d7f99235f1a41440eacac7a977e8fbd
commit r12-8114-g164c6a1c5d7f99235f1a41440eacac7a977e8fbd
Author: Jason Merrill <jason@redhat.com>
Date: Tue Apr 12 16:06:18 2022 -0400
c++: non-array new alignment [PR102071]
While considering the PR102071 patch for backporting, I noticed that I was
considering the alignment of the array new cookie even when there isn't one
because we aren't allocating an array.
PR c++/102071
gcc/cp/ChangeLog:
* init.cc (build_new_1): Check array_p for alignment.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/aligned-new9.C: Add single-object test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10/11 Regression] crash when combining -faligned-new=N with array cookie
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
` (9 preceding siblings ...)
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
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-12 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:394c852a6b4bed8117c790c2cd1553e224975ad5
commit r11-9982-g394c852a6b4bed8117c790c2cd1553e224975ad5
Author: Jason Merrill <jason@redhat.com>
Date: Sun Mar 27 12:36:13 2022 -0400
c++: low -faligned-new [PR102071]
This test ICEd after the constexpr new patch (r10-3661) because alloc_call
had a NOP_EXPR around it; fixed by moving the NOP_EXPR to alloc_expr. And
the PR pointed out that the size_t cookie might need more alignment, so I
fix that as well.
PR c++/102071
gcc/cp/ChangeLog:
* init.c (build_new_1): Include cookie in alignment. Omit
constexpr wrapper from alloc_call.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/aligned-new9.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10 Regression] crash when combining -faligned-new=N with array cookie
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
` (10 preceding siblings ...)
2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
@ 2022-05-12 21:24 ` cvs-commit at gcc dot gnu.org
2022-05-12 21:29 ` jason at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-12 21:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:fd669a0613aaa23222977eecc9e7165aa3fd1bcf
commit r10-10728-gfd669a0613aaa23222977eecc9e7165aa3fd1bcf
Author: Jason Merrill <jason@redhat.com>
Date: Sun Mar 27 12:36:13 2022 -0400
c++: low -faligned-new [PR102071]
This test ICEd after the constexpr new patch (r10-3661) because alloc_call
had a NOP_EXPR around it; fixed by moving the NOP_EXPR to alloc_expr. And
the PR pointed out that the size_t cookie might need more alignment, so I
fix that as well.
PR c++/102071
gcc/cp/ChangeLog:
* init.c (build_new_1): Include cookie in alignment. Omit
constexpr wrapper from alloc_call.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/aligned-new9.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/102071] [10 Regression] crash when combining -faligned-new=N with array cookie
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
` (11 preceding siblings ...)
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
12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-12 21:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 10.4, 11.3, 12.
^ 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).