Hi,

These are the patches for fixing PR109071 for GCC16 stage1:

Adding -fdiagnotics-details into GCC to provide more hints to the
end users on how the warnings come from, in order to help the user
to locate the exact location in source code on the specific warnings
due to compiler optimizations.

They base on the the following 4th version of the patch and rebased
on the latest trunk. 

bootstrapping and regression testing on both x86 and aarch64.

Kees and Sam have been using this option for a while in linux kernel
and other applications and both found very helpful.

They asked me several times about the status of this work and hope
the functionality can be available in GCC as soon as possible.

The diagnostic part of the patch had been reviewed and approved by
David already last year. 

Please review the middle-end part of the change.

thanks a lot.

Qing

===================

The latest version of(4th version) is:
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/667613.html
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/667614.html
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/667615.html
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/667616.html

The major improvements to this patch compared to version 3 are:

1. Divide the patch into 3 parts:
    Part 1: Add new data structure move_history, record move_history during
            transformation;
    Part 2: In warning analysis, Use the new move_history to form a rich
            location with a sequence of events, to report more context info
            of the warnings.
    Part 3: Add debugging mechanism for move_history.

2. Major change to the above Part 2, completely rewritten based on David's
   new class lazy_diagnostic_path. 

3. Fix all issues identied By Sam;
   A. fix PR117375 (Bug in tree-ssa-sink.cc);
   B. documentation clarification;
   C. Add all the duplicated PRs in the commit comments;

4. Bootstrap GCC with the new -fdiagnostics-details on by default (Init (1)).
   exposed some ICE similar as PR117375 in tree-ssa-sink.cc, fixed.

Qing Zhao (3):
  Provide more contexts for -Warray-bounds, -Wstringop-*warning messages
    due to code movements from compiler transformation (Part 1)
    [PR109071,PR85788,PR88771,PR106762,PR108770,PR115274,PR117179]
  Provide more contexts for -Warray-bounds, -Wstringop-*warning messages
    due to code movements from compiler transformation (Part 2)
    [PR109071,PR85788,PR88771,PR106762,PR108770,PR115274,PR117179]
  Provide more contexts for -Warray-bounds, -Wstringop-* warning
    messages due to code movements from compiler transformation (Part 3)
    [PR109071,PR85788,PR88771,PR106762,PR108770,PR115274,PR117179]

 gcc/Makefile.in                   |   2 +
 gcc/common.opt                    |   4 +
 gcc/diagnostic-move-history.cc    | 332 ++++++++++++++++++++++++++++++
 gcc/diagnostic-move-history.h     |  94 +++++++++
 gcc/doc/invoke.texi               |  11 +
 gcc/gimple-array-bounds.cc        |  39 ++--
 gcc/gimple-array-bounds.h         |   2 +-
 gcc/gimple-iterator.cc            |   3 +
 gcc/gimple-pretty-print.cc        |   4 +
 gcc/gimple-ssa-isolate-paths.cc   |  21 ++
 gcc/gimple-ssa-warn-access.cc     | 131 +++++++-----
 gcc/gimple-ssa-warn-restrict.cc   |  25 ++-
 gcc/move-history-rich-location.cc |  56 +++++
 gcc/move-history-rich-location.h  |  65 ++++++
 gcc/testsuite/gcc.dg/pr109071.c   |  43 ++++
 gcc/testsuite/gcc.dg/pr109071_1.c |  36 ++++
 gcc/testsuite/gcc.dg/pr109071_2.c |  50 +++++
 gcc/testsuite/gcc.dg/pr109071_3.c |  42 ++++
 gcc/testsuite/gcc.dg/pr109071_4.c |  41 ++++
 gcc/testsuite/gcc.dg/pr109071_5.c |  33 +++
 gcc/testsuite/gcc.dg/pr109071_6.c |  49 +++++
 gcc/testsuite/gcc.dg/pr117375.c   |  13 ++
 gcc/toplev.cc                     |   3 +
 gcc/tree-ssa-sink.cc              |  65 ++++++
 gcc/tree-ssa-threadupdate.cc      |  43 ++++
 25 files changed, 1124 insertions(+), 83 deletions(-)
 create mode 100644 gcc/diagnostic-move-history.cc
 create mode 100644 gcc/diagnostic-move-history.h
 create mode 100644 gcc/move-history-rich-location.cc
 create mode 100644 gcc/move-history-rich-location.h
 create mode 100644 gcc/testsuite/gcc.dg/pr109071.c
 create mode 100644 gcc/testsuite/gcc.dg/pr109071_1.c
 create mode 100644 gcc/testsuite/gcc.dg/pr109071_2.c
 create mode 100644 gcc/testsuite/gcc.dg/pr109071_3.c
 create mode 100644 gcc/testsuite/gcc.dg/pr109071_4.c
 create mode 100644 gcc/testsuite/gcc.dg/pr109071_5.c
 create mode 100644 gcc/testsuite/gcc.dg/pr109071_6.c
 create mode 100644 gcc/testsuite/gcc.dg/pr117375.c

-- 
2.43.5

Reply via email to