This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgomp/52993] New: gomp_init_nest_lock_25: possible bad call to memset


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52993

             Bug #: 52993
           Summary: gomp_init_nest_lock_25: possible bad call to memset
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dcb314@hotmail.com


I just tried to analyse the source code of gcc-4.8 trunk
dated 20120415 with the latest cppcheck-1.54.

It said

[libgomp/config/linux/lock.c:178]: (warning) Using size of pointer lock instead
of size of its data.

Source code is

void
gomp_init_nest_lock_25 (omp_nest_lock_25_t *lock)
{
  memset (lock, 0, sizeof (lock));
}

Maybe better is

void
gomp_init_nest_lock_25 (omp_nest_lock_25_t *lock)
{
  memset (lock, 0, sizeof (*lock));
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]