gcc support attribute((alloc_align(3))) , while llvm report an error, I don’t sure which behavior is better ?
see detail in Compiler Explorer
gcc support attribute((alloc_align(3))) , while llvm report an error, I don’t sure which behavior is better ?
see detail in Compiler Explorer
alloc_align
takes the index of an argument that specifies the alignment, not the alignment itself, so since you only have two arguments to the function the only legal values you can pass to alloc_align
are 1 and 2.
Also note GCC does not support it, it warns and drops the attribute, if you go and actually look at its stderr output:
<source>:3:1: warning: 'alloc_align' attribute argument value '3' exceeds the number of function parameters 2 [-Wattributes]