diff options
author | David Malcolm <dmalcolm@redhat.com> | 2019-12-20 11:20:44 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-01-14 20:42:04 -0500 |
commit | 03dc3f26231cbf5733330028e14706f8ad77fd5a (patch) | |
tree | 3d8be721ba491de74f1c3c0c5a2ca5f94c5df899 | |
parent | 697251b7a1bb7c14d3805de22248e83a23b90d1a (diff) | |
download | gcc-03dc3f26231cbf5733330028e14706f8ad77fd5a.zip gcc-03dc3f26231cbf5733330028e14706f8ad77fd5a.tar.gz gcc-03dc3f26231cbf5733330028e14706f8ad77fd5a.tar.bz2 |
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.
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-diagnostic-path.cc | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56e7995..2837364 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-01-14 David Malcolm <dmalcolm@redhat.com> + + * tree-diagnostic-path.cc (path_summary::event_range::print): + When testing for UNKNOWN_LOCATION, look through ad-hoc wrappers + using get_pure_location. + 2020-01-15 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/93262 diff --git a/gcc/tree-diagnostic-path.cc b/gcc/tree-diagnostic-path.cc index 9e2ff10..381a49c 100644 --- a/gcc/tree-diagnostic-path.cc +++ b/gcc/tree-diagnostic-path.cc @@ -172,7 +172,7 @@ class path_summary In particular the label for the event won't get printed. Fail more gracefully in this case by showing the event index and text, at no particular location. */ - if (initial_loc <= BUILTINS_LOCATION) + if (get_pure_location (initial_loc) <= BUILTINS_LOCATION) { for (unsigned i = m_start_idx; i <= m_end_idx; i++) { |