public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/108944] New: libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes]
@ 2023-02-27 11:21 dcb314 at hotmail dot com
  2023-02-27 13:40 ` [Bug modula2/108944] " gaius at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-27 11:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108944
           Summary: libgm2/libm2pim/sckt.cc:254:3: warning: memset()
                    called to fill 0 bytes. [memsetZeroBytes]
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Source code is

  memset (&sa, sizeof (struct sockaddr_in), 0);

Parameters wrong way around. Maybe better code:

  memset (&sa, 0, sizeof (struct sockaddr_in));

Thanks to static analyser cppcheck for finding this problem.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug modula2/108944] libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes]
  2023-02-27 11:21 [Bug modula2/108944] New: libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes] dcb314 at hotmail dot com
@ 2023-02-27 13:40 ` gaius at gcc dot gnu.org
  2023-02-27 15:31 ` dcb314 at hotmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-02-27 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-02-27
     Ever confirmed|0                           |1

--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Thank you very much for reporting this bug - very useful regarding PR108835 
(or at least it is related and timely).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug modula2/108944] libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes]
  2023-02-27 11:21 [Bug modula2/108944] New: libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes] dcb314 at hotmail dot com
  2023-02-27 13:40 ` [Bug modula2/108944] " gaius at gcc dot gnu.org
@ 2023-02-27 15:31 ` dcb314 at hotmail dot com
  2023-02-27 16:30 ` cvs-commit at gcc dot gnu.org
  2023-02-27 16:35 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-27 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Gaius Mulley from comment #1)
> Thank you very much for reporting this bug - very useful regarding PR108835 
> (or at least it is related and timely).

You are welcome. gcc flags -Wall and -Wmemset-transposed-args
seem to provide this warning.

For example:

memset.cc:17:15: warning: ‘memset’ used with constant zero length parameter;
thi
s could be due to transposed parameters [-Wmemset-transposed-args]
   17 |         memset( t.buf1, 20, 0);
      |         ~~~~~~^~~~~~~~~~~~~~~~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug modula2/108944] libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes]
  2023-02-27 11:21 [Bug modula2/108944] New: libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes] dcb314 at hotmail dot com
  2023-02-27 13:40 ` [Bug modula2/108944] " gaius at gcc dot gnu.org
  2023-02-27 15:31 ` dcb314 at hotmail dot com
@ 2023-02-27 16:30 ` cvs-commit at gcc dot gnu.org
  2023-02-27 16:35 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-27 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:

https://gcc.gnu.org/g:e5fcf084e381aefe170dcd418dc97e469dacfa91

commit r13-6359-ge5fcf084e381aefe170dcd418dc97e469dacfa91
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Mon Feb 27 16:29:18 2023 +0000

    libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes
[PR108944]

    The pattern parameter to memset is second.  Correct an obvious mistake
    in libm2pim/sckt.cc.

    libgm2/ChangeLog:

            PR modula2/108944
            * libm2pim/sckt.cc (getLocalIP): Correct parameter order.

    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug modula2/108944] libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes]
  2023-02-27 11:21 [Bug modula2/108944] New: libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes] dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-02-27 16:30 ` cvs-commit at gcc dot gnu.org
@ 2023-02-27 16:35 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-02-27 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Gaius Mulley <gaius at gcc dot gnu.org> ---
many thanks for the flag info - will use these when building.
Closing now that the master branch has this fix.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-27 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 11:21 [Bug modula2/108944] New: libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes. [memsetZeroBytes] dcb314 at hotmail dot com
2023-02-27 13:40 ` [Bug modula2/108944] " gaius at gcc dot gnu.org
2023-02-27 15:31 ` dcb314 at hotmail dot com
2023-02-27 16:30 ` cvs-commit at gcc dot gnu.org
2023-02-27 16:35 ` gaius 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).