public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109920] New: value-range.h: Mismatched new [] and delete
@ 2023-05-21 8:08 dcb314 at hotmail dot com
2023-05-21 8:10 ` [Bug c/109920] " dcb314 at hotmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2023-05-21 8:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109920
Bug ID: 109920
Summary: value-range.h: Mismatched new [] and delete
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
I just did a valgrind build of gcc trunk. It said
=91612== Mismatched free() / delete / delete []
==91612== at 0x484498A: operator delete(void*, unsigned long)
(vg_replace_malloc.c:1072)
==91612== by 0x18D285B: ~int_range (value-range.h:493)
==91612== by 0x18D285B: ~Value_Range (value-range.h:516)
==91612== by 0x18D285B: ranger_cache::fill_block_cache(tree_node*,
basic_block_def*, basic_block_def*) (gimple-range-cache.cc:1479)
Source code is
inline void
irange::maybe_resize (int needed)
{
if (!m_resizable || m_max_ranges == HARD_MAX_RANGES)
return;
if (needed > m_max_ranges)
{
m_max_ranges = HARD_MAX_RANGES;
wide_int *newmem = new wide_int[m_max_ranges * 2];
memcpy (newmem, m_base, sizeof (wide_int) * num_pairs () * 2);
m_base = newmem;
}
}
template<unsigned N, bool RESIZABLE>
inline
int_range<N, RESIZABLE>::~int_range ()
{
if (RESIZABLE && m_base != m_ranges)
delete m_base;
}
Note use of new [] and delete.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/109920] value-range.h: Mismatched new [] and delete
2023-05-21 8:08 [Bug c/109920] New: value-range.h: Mismatched new [] and delete dcb314 at hotmail dot com
@ 2023-05-21 8:10 ` dcb314 at hotmail dot com
2023-05-21 17:23 ` [Bug tree-optimization/109920] [14 Regression] " pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2023-05-21 8:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109920
David Binderman <dcb314 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at gcc dot gnu.org
--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Aldy's new value range code.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/109920] [14 Regression] value-range.h: Mismatched new [] and delete
2023-05-21 8:08 [Bug c/109920] New: value-range.h: Mismatched new [] and delete dcb314 at hotmail dot com
2023-05-21 8:10 ` [Bug c/109920] " dcb314 at hotmail dot com
@ 2023-05-21 17:23 ` pinskia at gcc dot gnu.org
2023-05-22 19:03 ` aldyh at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-21 17:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109920
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|value-range.h: Mismatched |[14 Regression]
|new [] and delete |value-range.h: Mismatched
| |new [] and delete
Version|unknown |14.0
Keywords| |ice-checking,
| |ice-on-valid-code
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/109920] [14 Regression] value-range.h: Mismatched new [] and delete
2023-05-21 8:08 [Bug c/109920] New: value-range.h: Mismatched new [] and delete dcb314 at hotmail dot com
2023-05-21 8:10 ` [Bug c/109920] " dcb314 at hotmail dot com
2023-05-21 17:23 ` [Bug tree-optimization/109920] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-05-22 19:03 ` aldyh at gcc dot gnu.org
2023-05-22 19:36 ` dcb314 at hotmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: aldyh at gcc dot gnu.org @ 2023-05-22 19:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109920
--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Created attachment 55137
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55137&action=edit
untested patch
Does this fix the problem?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/109920] [14 Regression] value-range.h: Mismatched new [] and delete
2023-05-21 8:08 [Bug c/109920] New: value-range.h: Mismatched new [] and delete dcb314 at hotmail dot com
` (2 preceding siblings ...)
2023-05-22 19:03 ` aldyh at gcc dot gnu.org
@ 2023-05-22 19:36 ` dcb314 at hotmail dot com
2023-05-23 6:56 ` cvs-commit at gcc dot gnu.org
2023-05-23 6:58 ` aldyh at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2023-05-22 19:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109920
--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Aldy Hernandez from comment #2)
> Created attachment 55137 [details]
> untested patch
>
> Does this fix the problem?
Yes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/109920] [14 Regression] value-range.h: Mismatched new [] and delete
2023-05-21 8:08 [Bug c/109920] New: value-range.h: Mismatched new [] and delete dcb314 at hotmail dot com
` (3 preceding siblings ...)
2023-05-22 19:36 ` dcb314 at hotmail dot com
@ 2023-05-23 6:56 ` cvs-commit at gcc dot gnu.org
2023-05-23 6:58 ` aldyh at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-23 6:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109920
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>:
https://gcc.gnu.org/g:493a63af6cbab094c36a76435c12b1886328dab8
commit r14-1083-g493a63af6cbab094c36a76435c12b1886328dab8
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Mon May 22 21:03:05 2023 +0200
Use delete[] in int_range destructor [PR109920]
gcc/ChangeLog:
PR tree-optimization/109920
* value-range.h (RESIZABLE>::~int_range): Use delete[].
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/109920] [14 Regression] value-range.h: Mismatched new [] and delete
2023-05-21 8:08 [Bug c/109920] New: value-range.h: Mismatched new [] and delete dcb314 at hotmail dot com
` (4 preceding siblings ...)
2023-05-23 6:56 ` cvs-commit at gcc dot gnu.org
@ 2023-05-23 6:58 ` aldyh at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: aldyh at gcc dot gnu.org @ 2023-05-23 6:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109920
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Fixed. David, thanks for the analysis. You did 99% of the work here :).
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-05-23 6:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-21 8:08 [Bug c/109920] New: value-range.h: Mismatched new [] and delete dcb314 at hotmail dot com
2023-05-21 8:10 ` [Bug c/109920] " dcb314 at hotmail dot com
2023-05-21 17:23 ` [Bug tree-optimization/109920] [14 Regression] " pinskia at gcc dot gnu.org
2023-05-22 19:03 ` aldyh at gcc dot gnu.org
2023-05-22 19:36 ` dcb314 at hotmail dot com
2023-05-23 6:56 ` cvs-commit at gcc dot gnu.org
2023-05-23 6:58 ` aldyh 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).