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: unassig...@gcc.gnu.org
        ReportedBy: dcb...@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));
}

Reply via email to