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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>:

https://gcc.gnu.org/g:03dc3f26231cbf5733330028e14706f8ad77fd5a

commit r10-5964-g03dc3f26231cbf5733330028e14706f8ad77fd5a
Author: David Malcolm <dmalc...@redhat.com>
Date:   Fri Dec 20 11:20:44 2019 -0500

    tree-diagnostic-path.cc: properly handle ad-hoc wrappers of
UNKNOWN_LOCATION

    In the reproducer for PR analyzer/58237 I noticed that some events that
    were missing locations were also missing text; for example event 3 here:

        |   15 |   while (fgets(buf, 10, fp) != NULL)
        |      |         ~
        |      |         |
        |      |         (2) following 'false' branch...
        |
      'f1': event 3
        |
        |cc1:
        |

    The root cause is that the path_summary-printing code doesn't consider
    ad-hoc locations when looking for reserved locations, and so fails to
    detect an unknown location for the case where an unknown location has
    been wrapped into an ad-hoc location to record a block.

    This patch fixes the issue by using get_pure_location, thus looking
    through ad-hoc wrappers, improving the result to:

        |   15 |   while (fgets(buf, 10, fp) != NULL)
        |      |         ~
        |      |         |
        |      |         (2) following 'false' branch...
        |
      'f1': event 3
        |
        |cc1:
        | (3): ...to here
        |

    gcc/ChangeLog:
        * tree-diagnostic-path.cc (path_summary::event_range::print):
        When testing for UNKNOWN_LOCATION, look through ad-hoc wrappers
        using get_pure_location.

Reply via email to