https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63710
Bug ID: 63710 Summary: Incorrect column number for -Wconversion Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com The column information can be improved by pinpointing the exact location where the conversion happens. Taking the following code as an example, in the expression "unsigned long r1 = ul + l", the variable "l" of type char is promoted to "unsigned long", so IMHO the warning should point at this variable instead of the operator '+'. ============================================ ========= Test Case ============== ============================================ $: cat s.c unsigned long f1(unsigned long ul, char l) { unsigned long r1 = ul + l; unsigned long r2 = l + ul; return r1 + r2; } $: $: gcc-trunk -c -Wconversion s.c s.c: In function ‘f1’: s.c:2:25: warning: conversion to ‘long unsigned int’ from ‘char’ may change the sign of the result [-Wsign-conversion] unsigned long r1 = ul + l; ^ s.c:3:24: warning: conversion to ‘long unsigned int’ from ‘char’ may change the sign of the result [-Wsign-conversion] unsigned long r2 = l + ul; ^ $: $: clang-trunk -c -Wconversion s.c s.c:2:27: warning: implicit conversion changes signedness: 'char' to 'unsigned long' [-Wsign-conversion] unsigned long r1 = ul + l; ~ ^ s.c:3:22: warning: implicit conversion changes signedness: 'char' to 'unsigned long' [-Wsign-conversion] unsigned long r2 = l + ul; ^ ~ 2 warnings generated.