https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112364
Peter Damianov <peter0x44 at disroot dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |peter0x44 at disroot dot org
--- Comment #14 from Peter Damianov <peter0x44 at disroot dot org> ---
../../gcc/gcc/../libgcc/libgcov-util.c: In function 'void tag_counters(unsigned
int, int)':
../../gcc/gcc/../libgcc/libgcov-util.c:214:59: warning: 'void* calloc(size_t,
size_t)' sizes specified with 'sizeof' in the earlier argument and not in the
later argument [-Wcalloc-transposed-args]
214 | k_ctrs[tag_ix].values = values = (gcov_type *) xcalloc (sizeof
(gcov_type),
|
^~~~~~~~~~~~~~~~~~
../../gcc/gcc/../libgcc/libgcov-util.c:214:59: note: earlier argument should
specify number of elements, later size of each element
../../gcc/gcc/../libgcc/libgcov-util.c: In function 'void
topn_to_memory_representation(gcov_ctr_info*)':
../../gcc/gcc/../libgcc/libgcov-util.c:529:43: warning: 'void* calloc(size_t,
size_t)' sizes specified with 'sizeof' in the earlier argument and not in the
later argument [-Wcalloc-transposed-args]
529 | = (struct gcov_kvp *)xcalloc (sizeof (struct gcov_kvp), n);
| ^~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/gcc/../libgcc/libgcov-util.c:529:43: note: earlier argument should
specify number of elements, later size of each element
I found a two more instances of this in libgcov-util.c
Personally I don't agree with this warning at all, it's FAR too spammy for what
it is, considering it never actually catches a real defect, but rather a minor
style choice that (IMO) does not affect readability in any case. Whether I see
sizeof in the first or second argument doesn't affect my understanding of the
code.
In a static analyzer, fine, but I think in GCC, no.
But I guess the same solution should be taken for this one, too, if it's an
issue in libgfortran also.