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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmalcolm at gcc dot gnu.org

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks; I agree that it's a dup.

The ranges in question are:

$2 = {locus = 201728, src_range = {m_start = 201568, m_finish = 2147483641},
data = 0x0}
(gdb) call inform (201728, "locus")
pr68473-3.c: In function ‘f’:
pr68473-3.c:11:19: note: locus
     else if (p->q != NULL) { }
                   ^

(gdb) call inform (201568, "m_start")
pr68473-3.c:11:14: note: m_start
     else if (p->q != NULL) { }
              ^

(gdb) call inform (2147483641, "m_finish")
pr68473-3.c:6:21: note: m_finish
 #define NULL (void*)0
                     ^

pr68473-3.c:11:22: note: in expansion of macro ‘NULL’
     else if (p->q != NULL) { }
                      ^~~~

With the patch, it prints:

pr68473-3.c: In function ‘f’:
pr68473-3.c:11:19: warning: duplicated ‘if’ condition [-Wduplicated-cond]
     else if (p->q != NULL) { }
                   ^

pr68473-3.c:10:14: note: previously used here
     if (p->q != NULL) { }
              ^

i.e. no range information. I believe this is degrading gracefully to
the old "just carets,  no ranges" result.


Perhaps ideally it might print some form of the ranges as they pertain to the
primary caret within the location:

pr68473-3.c: In function ‘f’:
pr68473-3.c:11:19: warning: duplicated ‘if’ condition [-Wduplicated-cond]
     else if (p->q != NULL) { }
              ~~~~~^~~~~~~

pr68473-3.c:10:14: note: previously used here
     if (p->q != NULL) { }
         ~~~~~^~~~~~~

but making it do that would be a much more involved patch.

Reply via email to