On Fri, Jun 19, 2026 at 1:35 AM Filip Kastl <[email protected]> wrote:
>
> Hi David.
>
> I haven't regstrapped this patch yet.  If you're ok with it, I'll regstrap and
> push it.
>
> Cheers,
> Filip Kastl
>
>
> --- 8< ---
>
>
> Compiling GCC with Clang gives these warnings in analyzer.  This patch
> fixes the stuff Clang complains about.
>
> diagnostic-manager.cc:1902:25: warning: comparison of integers of different 
> signs: 'int' and 'size_type' (aka 'unsigned long') [-Wsign-compare]
> engine.cc:1788:8: warning: unused variable 'logger' [-Wunused-variable]
> engine.cc:1796:8: warning: unused variable 'fn_result' [-Wunused-variable]
> region-model.cc:941:3: warning: 'mark_interesting_stuff' overrides a member 
> function but is not marked 'override' [-Winconsistent-missing-override]
> region-model.cc:947:3: warning: 'add_function_entry_event' overrides a member 
> function but is not marked 'override' [-Winconsistent-missing-override]
> shift-diagnostics.cc:144:3: warning: 'mark_interesting_stuff' overrides a 
> member function but is not marked 'override' [-Winconsistent-missing-override]
> /home/worker/buildworker/tiber-gcc-clang/build/gcc/analyzer/shift-diagnostics.cc:75:3:
>  warning: 'mark_interesting_stuff' overrides a member function but is not 
> marked 'override' [-Winconsistent-missing-override]
>
> gcc/analyzer/ChangeLog:
>
>         * diagnostic-manager.cc (diagnostic_manager::annotate_exploded_path):
>         Add explicit cast to unsigned so that we avoid comparing
>         signed and unsigned variables.
>         * engine.cc (interprocedural_return::try_to_rewind_data_flow):
>         Removed unused variables.
>         * region-model.cc: Add the override keyword.
>         * shift-diagnostics.cc: Add the override keyword.
>
> Signed-off-by: Filip Kastl <[email protected]>
> ---
>  gcc/analyzer/diagnostic-manager.cc | 2 +-
>  gcc/analyzer/engine.cc             | 3 ---
>  gcc/analyzer/region-model.cc       | 3 ++-
>  gcc/analyzer/shift-diagnostics.cc  | 4 ++--
>  4 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/analyzer/diagnostic-manager.cc 
> b/gcc/analyzer/diagnostic-manager.cc
> index 41b4c2a75a9..f69d0e780a1 100644
> --- a/gcc/analyzer/diagnostic-manager.cc
> +++ b/gcc/analyzer/diagnostic-manager.cc
> @@ -1899,7 +1899,7 @@ diagnostic_manager::annotate_exploded_path (const 
> path_builder &pb,
>       rewind state.  */
>    std::vector<region_model> src_models;
>    std::vector<region_model> dst_models;
> -  for (int idx = 0; idx < epath.m_elements.size (); ++idx)
> +  for (int idx = 0; (unsigned) idx < epath.m_elements.size (); ++idx)

I think we should just change the type of idx to unsigned instead of
adding the cast.

Thanks,
Andrea

>      {
>        auto eedge = epath.m_elements[idx].m_eedge;
>        if (logger)
> diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
> index 59cdcc51e6c..e4fce20017f 100644
> --- a/gcc/analyzer/engine.cc
> +++ b/gcc/analyzer/engine.cc
> @@ -1785,15 +1785,12 @@ interprocedural_return::add_events_to_path 
> (checker_path *emission_path,
>  bool
>  interprocedural_return::try_to_rewind_data_flow (rewind_context &ctxt) const
>  {
> -  auto logger = ctxt.m_logger;
> -
>    tree lhs = gimple_call_lhs (&m_call_stmt);
>    if (!lhs)
>      return true;
>
>    const region_model &src_enode_model = ctxt.get_src_region_model ();
>    tree fndecl = src_enode_model.get_current_function ()->decl;
> -  tree fn_result = DECL_RESULT (fndecl);
>
>    ctxt.on_data_flow (DECL_RESULT (fndecl), lhs);
>
> diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
> index d88651fc33b..6d4692d9944 100644
> --- a/gcc/analyzer/region-model.cc
> +++ b/gcc/analyzer/region-model.cc
> @@ -938,7 +938,7 @@ public:
>    }
>
>    void
> -  mark_interesting_stuff (interesting_t *interest)
> +  mark_interesting_stuff (interesting_t *interest) override
>    {
>      interest->add_read_region (m_divisor_reg, "divisor zero value");
>    }
> @@ -947,6 +947,7 @@ public:
>    add_function_entry_event (const exploded_edge &eedge,
>                             checker_path *emission_path,
>                             const state_transition_at_call *state_trans)
> +                           override
>    {
>      class custom_function_entry_event : public function_entry_event
>      {
> diff --git a/gcc/analyzer/shift-diagnostics.cc 
> b/gcc/analyzer/shift-diagnostics.cc
> index 724c1a18d64..a0d3f15dafe 100644
> --- a/gcc/analyzer/shift-diagnostics.cc
> +++ b/gcc/analyzer/shift-diagnostics.cc
> @@ -72,7 +72,7 @@ public:
>    }
>
>    void
> -  mark_interesting_stuff (interesting_t *interest)
> +  mark_interesting_stuff (interesting_t *interest) override
>    {
>      interest->add_read_region (m_src_region, "shift count value");
>    }
> @@ -141,7 +141,7 @@ public:
>    }
>
>    void
> -  mark_interesting_stuff (interesting_t *interest)
> +  mark_interesting_stuff (interesting_t *interest) override
>    {
>      interest->add_read_region (m_src_region, "shift count value");
>    }
> --
> 2.54.0

Reply via email to