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

--- Comment #8 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
The concatenation:

The concatenated string comes from 4 string tokens, with the following
locations, and locs[1] is a bogus value:

../../src/pr79210-via-attachment.c:8:6: note: locs[0]
      "0423 lpfc_"#attr" attribute cannot be set to %d, "\
      ^~~~~~~~~~~~
../../src/pr79210-via-attachment.c:18:1: note: locs[1]
     "other.");
 ^~~~~~~~~~~~~~~~~~~~
../../src/pr79210-via-attachment.c:8:23: note: locs[2]
      "0423 lpfc_"#attr" attribute cannot be set to %d, "\
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      "allowed range is [0, 1]\n", val); \

../../src/pr79210-via-attachment.c:9:6: note: locs[3]
      "allowed range is [0, 1]\n", val); \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that diagnostic_show_locus doesn't print the full range of garbage value
locs[1] correctly, and needed this patch:

diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
index 5c386ae..a41b19a 100644
--- a/gcc/diagnostic-show-locus.c
+++ b/gcc/diagnostic-show-locus.c
@@ -1367,9 +1367,11 @@ layout::get_state_at_point (/* Inputs.  */
          /* Within a multiline range, don't display any underline
             in any leading or trailing whitespace on a line.
             We do display carets, however.  */
+#if 0
          if (!out_state->draw_caret_p)
            if (column < first_non_ws || column > last_non_ws)
              return false;
+#endif

          /* We are within a range.  */
          return true;

to avoid just printing:

(gdb) call inform(result->src_loc, "")
../../src/pr79210-via-attachment.c:18:1: note: 
     "other.");
 ^   ~~~~~~~~~~

Reply via email to