public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61294] [4.9 Regression] erroneous memset used with constant zero length parameter warning
Date: Mon, 26 May 2014 12:45:00 -0000	[thread overview]
Message-ID: <bug-61294-4-fUdtVKJN5V@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61294-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61294

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
That is,

inline vtkIdType vtkPointSet::GetNumberOfPoints()
{
  if (this->Points)
    {
    return this->Points->GetNumberOfPoints();
    }
  else
    {
    return 0;
    }
}

and


void vtkDistributedDataFilter::AddConstantUnsignedCharPointArray(
  vtkUnstructuredGrid *grid, const char *arrayName, unsigned char val)
{
  vtkIdType npoints = grid->GetNumberOfPoints();
  unsigned char *vals = new unsigned char [npoints];
  memset(vals, val, npoints);
}

may allocate zero points and initialize zero points due to that extra
"safety" check.  If you put a assert (npoints > 0) in there then
the warning will go away.


  parent reply	other threads:[~2014-05-26 12:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 15:29 [Bug c++/61294] New: " orion at cora dot nwra.com
2014-05-26 12:42 ` [Bug c++/61294] " rguenth at gcc dot gnu.org
2014-05-26 12:45 ` rguenth at gcc dot gnu.org [this message]
2014-05-26 12:45 ` rguenth at gcc dot gnu.org
2014-05-29 15:46 ` orion at cora dot nwra.com
2014-06-03 13:11 ` [Bug middle-end/61294] " jason at gcc dot gnu.org
2014-06-25 11:37 ` jakub at gcc dot gnu.org
2014-07-14  7:37 ` jakub at gcc dot gnu.org
2014-07-16 13:29 ` jakub at gcc dot gnu.org
2014-08-06 15:30 ` pinskia at gcc dot gnu.org
2014-10-30 10:40 ` jakub at gcc dot gnu.org
2014-11-24 16:45 ` rguenth at gcc dot gnu.org
2014-11-24 16:50 ` jakub at gcc dot gnu.org
2014-11-24 19:27 ` carlos at gcc dot gnu.org
2014-11-27  5:47 ` siddhesh at redhat dot com
2015-06-26 20:06 ` jakub at gcc dot gnu.org
2015-06-26 20:35 ` jakub at gcc dot gnu.org
2023-03-31 11:42 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-61294-4-fUdtVKJN5V@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).