Bug 69664 - [6 Regression] column info is lost
Summary: [6 Regression] column info is lost
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 6.0
: P1 normal
Target Milestone: 6.0
Assignee: David Malcolm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-04 01:54 UTC by Manuel López-Ibáñez
Modified: 2018-01-27 19:47 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-02-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel López-Ibáñez 2016-02-04 01:54:02 UTC
GCC 5.2

prog.cc:1:5: warning: "/*" within comment [-Wcomment]
  /* /* */
     ^

GCC 6.0

prog.cc:1:0: warning: "/*" within comment [-Wcomment]
  /* /* */
Comment 1 Manuel López-Ibáñez 2016-02-04 02:23:36 UTC
We have testcases that test Wcomment,

gcc.dg/cpp/trad/comment-2.c
gcc.dg/cpp/warn-comments.c

but none of them check column numbers.
Comment 2 Richard Biener 2016-02-04 12:29:31 UTC
Confirmed.
Comment 3 David Malcolm 2016-02-04 17:21:37 UTC
Issue appears to be with rich_location::override_column, it's called by cpp_diagnostic_with_line, but it doesn't seem to be working.  Am investigating.
Comment 4 David Malcolm 2016-02-04 22:30:56 UTC
Candidate patch posted here:
  https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00372.html
Comment 5 David Malcolm 2016-02-08 17:34:17 UTC
Author: dmalcolm
Date: Mon Feb  8 17:33:45 2016
New Revision: 233223

URL: https://gcc.gnu.org/viewcvs?rev=233223&root=gcc&view=rev
Log:
PR preprocessor/69664: fix rich_location::override_column

gcc/testsuite/ChangeLog:
	PR preprocessor/69664
	* gcc.dg/cpp/trad/comment-2.c: Add expected column number.
	* gcc.dg/cpp/warn-comments.c: Likewise.

libcpp/ChangeLog:
	PR preprocessor/69664
	* errors.c (cpp_diagnostic_with_line): Only call
	rich_location::override_column if the column is non-zero.
	* line-map.c (rich_location::override_column): Update columns
	within m_ranges[0].  Add assertions to verify that doing so is
	sane.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/cpp/trad/comment-2.c
    trunk/gcc/testsuite/gcc.dg/cpp/warn-comments.c
    trunk/libcpp/ChangeLog
    trunk/libcpp/errors.c
    trunk/libcpp/line-map.c
Comment 6 David Malcolm 2016-02-08 17:35:14 UTC
Should be fixed by r233223; marking as RESOLVED FIXED.