On 03/02/16 21:01, Prasad Ghangal wrote:
Hi !
I am new to gcc. I would like to solve bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49973 (Bug 49973 - Column
numbers count special characters as multiple columns ). Can somebody
guide me?

I tried to debug gcc under gdb. I think I have to change code in c-parser.c

I think this should be fixed in libcpp, probably in lex.c, but maybe other places also. A good testcase to start with would be:

/* ñ /* */
/* a /* */

cc1 -Wcomment

prog.cc:1:7: warning: "/*" within comment [-Wcomment]
 /* ñ /* */
       ^
prog.cc:2:6: warning: "/*" within comment [-Wcomment]
 /* a /* */
      ^

Both locations should point to column 6. Look for places where column info is converted to source_location (linemap_position_for_column or linemap_position_for_line_and_colum). Figure out where the column info got the wrong value. Use something like wcwidth() to measure the width of non-ASCII characters and get the right width of 'ñ'.

Unfortunately, GCC 6 seems to be broken for the above testcase (https://gcc.gnu.org/PR69664). Revision 229665 seems fine.

Cheers,

Manuel.

Reply via email to