https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112364
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Keywords| |easyhack
Ever confirmed|0 |1
Last reconfirmed| |2023-11-03
--- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Martin Uecker from comment #0)
> Note that for the allocated size the order of arguments does not matter, but
> - at least according to my understanding - the alignment requirements for
> the returned memory may depend on the object size being the second argument.
No, per the standard we can assign the result of calloc to T* iff T has a
fundamental alignment requirement, i. e. _Alignof (max_align_t) >= _Alignof
(T). It's not related to the specified size in calloc call.
But anyway in this case the order of arguments is indeed wrong and it should be
fixed.