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

            Bug ID: 118181
           Summary: gcc/lto-ltrans-cache.cc:312: Avoid call by value for
                    large objects
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Static analyser cppcheck says:

gcc/lto-ltrans-cache.cc:312:44: performance: Function parameter 'checksum'
should be passed by const reference. [passedByValue]

Source code is

ltrans_file_cache::create_item (checksum_t checksum)

but

trunk $ grep checksum_t gcc/lto*.h
gcc/lto-ltrans-cache.h:using checksum_t = std::array<uint8_t, 32>;

So checksum_t is at least 32 bytes large. Suggest new code

ltrans_file_cache::create_item (const checksum_t & checksum)

git blame says:

8b1a57284043 (Michal Jires 2023-11-17 21:17:11 +0100 312)
ltrans_file_cache::create_item (checksum_t checksum)

Reply via email to