------- Additional Comments From gcc at sopwith dot solgatos dot com 2005-03-15 23:22 ------- I observe that gcc -Wconversion generates the exact same warning message for converting from narrow to wide as it does for converting from wide to narrow. Correct me if I'm wrong, but converting from narrow to wide should always be safe, while converting from wide to narrow is not safe. I would like to be able to find the unsafe conversions without drowning in warning messages about safe conversions. This would make porting code from ILP32 to LP64 easier.
sopwith cat conversion2.c #include <stdio.h> void func1(int); void func2(long); int main(void) { long a; func1(5); func2(5); /* line 12 - conversion appears to be harmless? */ a = 5; func1(a); /* line 15 - conversion appears to be harmless? (since the data fits in 32 bits) */ func2(a); a = 50000000000; func1(a); /* line 19 - conversion throws away data */ func2(a); return 0; } void func1(int arg) { printf("func1: arg = %d\n", arg); } void func2(long arg) { printf("func2: arg = %ld\n", arg); } sopwith gcc -O2 -Wconversion conversion2.c -o conversion2 conversion2.c: In function `main': conversion2.c:12: warning: passing arg 1 of `func2' with different width due to prototype conversion2.c:15: warning: passing arg 1 of `func1' with different width due to prototype conversion2.c:19: warning: passing arg 1 of `func1' with different width due to prototype sopwith ./conversion2 func1: arg = 5 func2: arg = 5 func1: arg = 5 func2: arg = 5 func1: arg = -1539607552 func2: arg = 50000000000 sopwith -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9072 ------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]