airbus-seclab / c-compiler-security

Security-related flags and options for C compilers
https://airbus-seclab.github.io/c-compiler-security/
Creative Commons Attribution Share Alike 4.0 International
181 stars 16 forks source link

about "-Wshorten-64-to-32: warn on 64 bits truncation (long to int for example)" #8

Closed szennou closed 3 years ago

szennou commented 3 years ago

C norm specifies that sizeof(long) >= sizeof(int). Note the ">=". I suggest to either remove your example or add "on architectures where sizeof(long) < sizeof(int)"