public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation
@ 2020-06-22 3:22 johelegp at gmail dot com
2020-10-02 22:48 ` [Bug c++/95808] " redi at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: johelegp at gmail dot com @ 2020-06-22 3:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
Bug ID: 95808
Summary: Can mismatch non-array new/delete with array
new/delete during constant evaluation
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: johelegp at gmail dot com
Target Milestone: ---
See https://godbolt.org/z/ZHiKmm.
```C++
constexpr void f()
{
delete[] new int;
delete new int[1];
}
constexpr int x{([]() consteval { f(); }(), 0)};
```
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
@ 2020-10-02 22:48 ` redi at gcc dot gnu.org
2020-10-15 15:33 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-02 22:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|wrong-code |accepts-invalid
Last reconfirmed| |2020-10-02
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
2020-10-02 22:48 ` [Bug c++/95808] " redi at gcc dot gnu.org
@ 2020-10-15 15:33 ` jakub at gcc dot gnu.org
2020-10-29 15:27 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-10-15 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 49381
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49381&action=edit
gcc11-pr95808.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
2020-10-02 22:48 ` [Bug c++/95808] " redi at gcc dot gnu.org
2020-10-15 15:33 ` jakub at gcc dot gnu.org
@ 2020-10-29 15:27 ` cvs-commit at gcc dot gnu.org
2020-10-29 16:09 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-29 15:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:815baade9a07d361b1daa1dcfbbda2a79f3ebb52
commit r11-4538-g815baade9a07d361b1daa1dcfbbda2a79f3ebb52
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Oct 29 16:27:01 2020 +0100
c++: Diagnose constexpr delete [] new int; and delete new int[N]; [PR95808]
This patch diagnoses delete [] new int; and delete new int[1]; in constexpr
contexts by remembering
IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun)) & OVL_OP_FLAG_VEC
from the operator new and checking it at operator delete time.
2020-10-29 Jakub Jelinek <jakub@redhat.com>
PR c++/95808
* cp-tree.h (enum cp_tree_index): Add
CPTI_HEAP_VEC_UNINIT_IDENTIFIER
and CPTI_HEAP_VEC_IDENTIFIER.
(heap_vec_uninit_identifier, heap_vec_identifier): Define.
* decl.c (initialize_predefined_identifiers): Initialize those
identifiers.
* constexpr.c (cxx_eval_call_expression): Reject array allocations
deallocated with non-array deallocation or non-array allocations
deallocated with array deallocation.
(non_const_var_error): Handle heap_vec_uninit_identifier and
heap_vec_identifier too.
(cxx_eval_constant_expression): Handle also
heap_vec_uninit_identifier
and in that case during initialization replace it with
heap_vec_identifier.
(find_heap_var_refs): Handle heap_vec_uninit_identifier and
heap_vec_identifier too.
* g++.dg/cpp2a/constexpr-new15.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
` (2 preceding siblings ...)
2020-10-29 15:27 ` cvs-commit at gcc dot gnu.org
@ 2020-10-29 16:09 ` jakub at gcc dot gnu.org
2021-08-04 17:15 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-10-29 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
` (3 preceding siblings ...)
2020-10-29 16:09 ` jakub at gcc dot gnu.org
@ 2021-08-04 17:15 ` pinskia at gcc dot gnu.org
2021-08-28 0:00 ` pinskia at gcc dot gnu.org
2021-08-29 0:34 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04 17:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed so closing as such.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
` (4 preceding siblings ...)
2021-08-04 17:15 ` pinskia at gcc dot gnu.org
@ 2021-08-28 0:00 ` pinskia at gcc dot gnu.org
2021-08-29 0:34 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-28 0:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |euloanty at live dot com
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 93668 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
` (5 preceding siblings ...)
2021-08-28 0:00 ` pinskia at gcc dot gnu.org
@ 2021-08-29 0:34 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-29 0:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 95797 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-08-29 0:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 3:22 [Bug c++/95808] New: Can mismatch non-array new/delete with array new/delete during constant evaluation johelegp at gmail dot com
2020-10-02 22:48 ` [Bug c++/95808] " redi at gcc dot gnu.org
2020-10-15 15:33 ` jakub at gcc dot gnu.org
2020-10-29 15:27 ` cvs-commit at gcc dot gnu.org
2020-10-29 16:09 ` jakub at gcc dot gnu.org
2021-08-04 17:15 ` pinskia at gcc dot gnu.org
2021-08-28 0:00 ` pinskia at gcc dot gnu.org
2021-08-29 0:34 ` pinskia 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).