This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52952] Wformat location info is bad (wrong column number)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952

--- Comment #31 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
(In reply to Manuel LÃpez-IbÃÃez from comment #30)
> Created attachment 33647 [details]
> create locations from loc + offset
> 
> This variant works for simple strings. However, it cannot handle even simple
> macros:

In addition, there is the issue that GCC does not track the location of
initializers. Thus, I had to explicitly disable the offset computation in case
of VAR_DECL.

Clang by comparison perfectly handles this case:

format.c:11:21: warning: more '%' conversions than data arguments [-Wformat]
   __builtin_printf(a);
                    ^
format.c:5:18: note: format string is defined here
const char a[] = FORMAT;
                 ^
format.c:1:18: note: expanded from macro 'FORMAT'
#define FORMAT "%d"
                ~^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]