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

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).