ср, 17 дек. 2025 г., 17:28 Andrew Randrianasulu <[email protected]>:
Trying to see if there were more such warnings than simply in guicast/bootstrap.C (this one kills compiled program on Sparc32) I added
CFLAGS += -Wcast-align
to global_config after configure generated it
Aaaand ... it seems that our python code really generates c files with loads of those cast-align warnings, but some core files have them too ...
I honestly do not know how to properly fix this :(
v
make -j8 > MLOG 2>&1
grep warning MLOG | grep Wcast | wc -l 1921
bccapture.C:77:24: warning: cast from 'const char *' to 'const u_int32_t *' (aka 'const unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] bcresources.C:417:20: warning: cast from 'const char *' to 'const u_int32_t *' (aka 'const unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] bcresources.C:1842:19: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]
bcresources.C:1843:19: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] bcresources.C:1850:19: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] bcresources.C:1851:19: warning: cast from 'char *' to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] bcwindowbase.C:475:25: warning: cast from 'const char *' to 'const u_int32_t *' (aka 'const unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] units.C:584:7: warning: cast from 'const char *' to 'const uint32_t *' (aka 'const unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] units.C:617:7: warning: cast from 'const char *' to 'const uint32_t *' (aka 'const unsigned int *') increases required alignment from 1 to 4 [-Wcast-align] bcwindowbase.C:4448:18: warning: cast from 'uint8_t *' (aka 'unsigned char *') to 'unsigned int *' increases required alignment from 1 to 4 [-Wcast-align] vframe.C:968:15: warning: cast from 'unsigned char *' to 'float *' increases required alignment from 1 to 4 [-Wcast-align]
vframe.C:971:15: warning: cast from 'unsigned char *' to 'float *' increases required alignment from 1 to 4 [-Wcast-align] vframe.C:973:15: warning: cast from 'unsigned char *' to 'float *' increases required alignment from 1 to 4 [-Wcast-align] vframe.C:975:15: warning: cast from 'unsigned char *' to 'float *' increases required alignment from 1 to 4 [-Wcast-align] vframe.C:993:3: warning: cast from 'unsigned char *' to 'uint16_t *' (aka 'unsigned short *') increases required alignment from 1 to 2 [-Wcast-align] ====
and so on ...
They are harmless on x86/arm, but surely kills program on mips64/sparc (and may be Alpha).
Apparently there was new way about dealing with some of such problems, alignas(type) construction from c11. https://wiki.sei.cmu.edu/confluence/spaces/c/pages/87152059/EXP36-C.+Do+not+... But right now I prefer not to force c11 as base compiler .... May be it can be ifdefed at least in non-autogenerated code?