Skip to content

CI: enable Infer for static analysis - #360

Open
Smattr wants to merge 10 commits into
mainfrom
smattr/8dbf2bd7-dae6-498d-902b-3109448c5391
Open

Smattr wants to merge 10 commits into
mainfrom
smattr/8dbf2bd7-dae6-498d-902b-3109448c5391

Conversation

@Smattr

@Smattr Smattr commented Sep 26, 2026

Copy link
Copy Markdown
Owner

No description provided.

6d77082 seems to have not noticed this
was already present.
Oddly the warning that led to b726346
did not also warn on this near-identical code.

Reported-by: GCC 16.2.1 -Wunused-but-set-variable
Infer says:

  [HIGH] common/isa.h:5:35: Function parameter `ptr` is passed by-value
    but not modified inside this function, resulting in a potential
    unnecessary copy at the function's callsites.
    [infer-pulse-const-refable]
  template <typename T, typename U> static inline bool isa(const U ptr) {
                                    ^
  [HIGH] librumur/src/resolve-symbols.cc:648:22: variable `&resolved` is
    copied into an intermediate and is never modified.
    [infer-pulse-unnecessary-copy-intermediate]
        if (isa<Range>(resolved)) {
                       ^

These are essentially false positives. None of the copies here are a
significant cost. But we may as well pacify the tool and adhere to
better style.

Reported-by: Infer 1.3.0
Infer says:

  [HIGH] rumur/src/generate-print.cc:63:1: Function parameter `width` is
    passed by-value but not modified inside this function, resulting in
    a potential unnecessary copy at the function's callsites.
    [infer-pulse-const-refable]
  static std::string derive_handle(const std::string &handle,
  ^
  [HIGH] rumur/src/generate-print.cc:73:70: variable `width` is copied
    into an intermediate and is never modified.
    [infer-pulse-unnecessary-copy-intermediate]
  return derive_handle(handle, … width);
                                 ^
  [HIGH] rumur/src/generate-print.cc:147:64: variable `&w` is copied
    into an intermediate and is never modified.
    [infer-pulse-unnecessary-copy-intermediate]
        const std::string ph = derive_handle(previous_handle, o, w);
                                                                 ^

It is unlikely this could lead to any performance issue, but it is a
reasonable point that we do not know the structure of `mpz_class` and
would like to remain agnostic to it.

Reported-by: Infer 1.3.0
Infer says:

  [HIGH] rumur/src/generate-print.cc:71:1: Function parameter `offset`
    is passed by-value but not modified inside this function, resulting
    in a potential unnecessary copy at the function's callsites.
    [infer-pulse-const-refable]
  static std::string derive_handle(const std::string &handle, …
  ^

It is unlikely this could lead to any performance issue, but it is a
reasonable point that we do not know the structure of `mpz_class` and
would like to remain agnostic to it.

Reported-by: Infer 1.3.0
Infer says:

  [HIGH] rumur/src/generate-print.cc:71:1: Function parameter `width` is
    passed by-value but not modified inside this function, resulting in
    a potential unnecessary copy at the function's callsites.
    [infer-pulse-const-refable]
  static std::string derive_handle(const std::string &handle, …
  ^

It is unlikely this could lead to any performance issue, but it is a
reasonable point that we do not know the structure of `mpz_class` and
would like to remain agnostic to it.

Reported-by: Infer 1.3.0
Infer says:

  [HIGH] rumur/src/optimise-field-ordering.cc:13:1: Function parameter
    `v` is passed by-value but not modified inside this function,
    resulting in a potential unnecessary copy at the function's
    callsites. [infer-pulse-const-refable]
  static bool is_onehot(mpz_class v) {
  ^

It is unlikely this could lead to any performance issue, but it is a
reasonable point that we do not know the structure of `mpz_class` and
would like to remain agnostic to it.

Reported-by: Infer 1.3.0
Infer says:

  [HIGH] librumur/src/Expr.cc:968:17: variable `&a` is copied into an
    intermediate and is never modified.
    [infer-pulse-unnecessary-copy-intermediate]
    return lshift(a, b);
                  ^
  [HIGH] librumur/src/Expr.cc:968:20: variable `&b` is copied into an
    intermediate and is never modified.
    [infer-pulse-unnecessary-copy-intermediate]
    return lshift(a, b);
                     ^

I would expect all contemporary compilers to be able to see through this
and avoid the copy. But it does not help to give them more explicit
encouragement.

Reported-by: Infer 1.3.0
Infer says:

  [HIGH] librumur/src/Expr.cc:1018:17: variable `&a` is copied into an
    intermediate and is never modified.
    [infer-pulse-unnecessary-copy-intermediate]
    return rshift(a, b);
                  ^
  [HIGH] librumur/src/Expr.cc:1018:20: variable `&b` is copied into an
    intermediate and is never modified.
    [infer-pulse-unnecessary-copy-intermediate]
    return rshift(a, b);
                     ^

I would expect all contemporary compilers to be able to see through this
and avoid the copy. But it does not help to give them more explicit
encouragement.

Reported-by: Infer 1.3.0
@Smattr
Smattr force-pushed the smattr/8dbf2bd7-dae6-498d-902b-3109448c5391 branch from 0f2bbd3 to ee2dbba Compare September 26, 2026 23:54
Smattr added a commit that referenced this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant