This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgomp/52993] New: gomp_init_nest_lock_25: possible bad call to memset
- From: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 15 Apr 2012 10:52:45 +0000
- Subject: [Bug libgomp/52993] New: gomp_init_nest_lock_25: possible bad call to memset
- Auto-submitted: auto-generated
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));
}