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 preprocessor/78324] Valgrind issues seen with gcc.dg/tree-ssa/builtin-sprintf-2.c


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

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Thu Nov 17 15:55:26 2016
New Revision: 242552

URL: https://gcc.gnu.org/viewcvs?rev=242552&root=gcc&view=rev
Log:
Fix locations within raw strings

Whilst investigating PR preprocessor/78324 I noticed that the
substring location code currently doesn't handle raw strings
correctly, by not skipping the 'R', opening quote, delimiter
and opening parenthesis.

For example, an attempt to underline chars 4-7 with caret at 6 of
this raw string yields this erroneous output:
   __emit_string_literal_range (R"foo(0123456789)foo",
                                    ~~^~

With the patch, the correct range/caret is printed:

   __emit_string_literal_range (R"foo(0123456789)foo",
                                          ~~^~

gcc/ChangeLog:
        * input.c (selftest::test_lexer_string_locations_long_line): New
        function.
        (selftest::test_lexer_string_locations_raw_string_multiline): New
        function.
        (selftest::input_c_tests): Call the new functions, via
        for_each_line_table_case.

gcc/testsuite/ChangeLog:
        * gcc.dg/plugin/diagnostic-test-string-literals-1.c
        (test_raw_string_one_liner): New function.
        (test_raw_string_multiline): New function.

libcpp/ChangeLog:
        * charset.c (cpp_interpret_string_1): Skip locations from
        loc_reader when advancing 'p' when handling raw strings.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/input.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-string-literals-1.c
    trunk/libcpp/ChangeLog
    trunk/libcpp/charset.c

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