history.c:310:29: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
history.c:311:29: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
history.c:312:29: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
memset(hours, '\0', sizeof(hours));
memset(minutes, '\0', sizeof(minutes));
memset(seconds, '\0', sizeof(seconds));
Which version of gcc you are using ?
I've got 4.9.2-10 and getting no compiler warnings:
Three year old compiler is very old.
Current released version of gcc is 7.2 - I am using 8.0 (development
snapshot).
Suggest upgrade, if you can.
It is a bug.
Instead of
char* hours = myMalloc(12);etc use
char hours[12];etc and make sure not to use
free()or specify the size with the same
#defineinstead of the literal 12 both formyMallocandmemset.Or using 'malloc_usable_size' if available.
My mistake. I tought, that an array had been used instead of a pointer.
Patch commited.