还可以使用 -xport64 选项来检查这种情况:标准 ISO C 值保留规则允许在无符号整型的表达式中进行带符号整数值的符号扩展。这种符号扩展会产生细微的运行时错误。
example% cat test3.c int i= -1; void promo(unsigned long l) {} int main() { unsigned long l; l = i; // warn promo(i); // warn } example% CC -c -xarch=v9 -Qoption ccfe -xport64=full test3.c "test3.c", line 6: Warning: Sign extension from "int" to 64-bit integer. "test3.c", line 7: Warning: Sign extension from "int" to 64-bit integer. 2 Warning(s) detected. |