[Bug c++/102071] [10/11 Regression] crash when combining -faligned-new=N with array cookie

2022-05-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071

--- Comment #7 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jason Merrill
:

https://gcc.gnu.org/g:394c852a6b4bed8117c790c2cd1553e224975ad5

commit r11-9982-g394c852a6b4bed8117c790c2cd1553e224975ad5
Author: Jason Merrill 
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.

[Bug c++/102071] [10/11 Regression] crash when combining -faligned-new=N with array cookie

2022-04-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:164c6a1c5d7f99235f1a41440eacac7a977e8fbd

commit r12-8114-g164c6a1c5d7f99235f1a41440eacac7a977e8fbd
Author: Jason Merrill 
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.