These are the census rows most likely to be real 64-bit defects rather than
tidiness, so they are worth separating from the unused-symbol cleanup:
| instances |
flag |
group |
| 74 |
-Wshorten-64-to-32 |
port |
| 4 |
-Wshorten-64-to-32 |
runtime (nativeMethods.m) |
| 6 |
-Wpointer-to-int-cast |
runtime (nativeMethods.m, cn1_globals.m) |
-Wpointer-to-int-cast here reads "cast to smaller integer type" -- a
pointer being narrowed, which silently corrupts any address above 4GB. The
-Wshorten-64-to-32 rows are "implicit conversion loses integer precision".
Each site needs reading rather than a blanket cast: the right answer is
sometimes to widen the destination, sometimes to route through uintptr_t, and
sometimes the value genuinely is bounded and an explicit cast documents that.
An added cast that merely silences the diagnostic without establishing the bound
is worse than the warning, because it removes the evidence.
Related, already fixed and useful as a model: the IOSNative.m and
cn1_globals.m pointer/integer conversions retired earlier in this work went
through (JAVA_LONG)(uintptr_t) rather than a direct cast.
Also in this family but smaller: -Wpointer-sign (7), -Wnonnull (4),
-Wincompatible-pointer-types (6), -Wmismatched-parameter-types (1).
Found by the native warning census (scripts/check-native-warnings.py).
These are the census rows most likely to be real 64-bit defects rather than
tidiness, so they are worth separating from the unused-symbol cleanup:
-Wshorten-64-to-32-Wshorten-64-to-32nativeMethods.m)-Wpointer-to-int-castnativeMethods.m,cn1_globals.m)-Wpointer-to-int-casthere reads "cast to smaller integer type" -- apointer being narrowed, which silently corrupts any address above 4GB. The
-Wshorten-64-to-32rows are "implicit conversion loses integer precision".Each site needs reading rather than a blanket cast: the right answer is
sometimes to widen the destination, sometimes to route through
uintptr_t, andsometimes the value genuinely is bounded and an explicit cast documents that.
An added cast that merely silences the diagnostic without establishing the bound
is worse than the warning, because it removes the evidence.
Related, already fixed and useful as a model: the
IOSNative.mandcn1_globals.mpointer/integer conversions retired earlier in this work wentthrough
(JAVA_LONG)(uintptr_t)rather than a direct cast.Also in this family but smaller:
-Wpointer-sign(7),-Wnonnull(4),-Wincompatible-pointer-types(6),-Wmismatched-parameter-types(1).Found by the native warning census (
scripts/check-native-warnings.py).