[Chapel Merge] Work around a GCC 13 error

Branch: refs/heads/main
Revision: 17117caeffe6863d8f2e31ca41e0fda0800c2f47
Author: mppf
Link: Work around a GCC 13 error by mppf · Pull Request #25889 · chapel-lang/chapel · GitHub
Log Message:
Work around a GCC 13 error (#25889)

Follow-up to #25853. This PR avoids errors from GCC 13 when building
with make DEBUG=0 WARNINGS=1 ASSERTS=0 OPTIMIZE=1 compiler. The
warnings look like this:

/usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 40 is out of the bounds [0, 40] of object ‘<anonymous>’ with type ‘chpl::resolution::MatchingIdsWithName’ [-Werror=array-bounds=]
  437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      >             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mppf/w/main/frontend/lib/resolution/scope-queries.cpp: In function ‘const bool& chpl::resolution::emitMultipleDefinedSymbolErrorsQuery(chpl::Context*, const Scope*)’:
/home/mppf/w/main/frontend/lib/resolution/scope-queries.cpp:3585:35: note: ‘<anonymous>’ declared here
 3585 |       v = lookupNameInScopeTracing(context, scope, { }, name, config,
      >           ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 3586 |                                    traceResult);
      >                                    ~~~~~~~~~~~~

It is currently unclear to me if the error is a false positive. However,
I figured out a workaround by introducing a new variable to store the
result of lookupNameInScopeTracing here.

Trivial and not reviewed.

  • full comm=none testing

Compare: Comparing 20de6bb75e9cbc2a677ce67bd8c6f21be84d135b...0a7f097501b9156db1330d23c87d46c9787d53ea · chapel-lang/chapel · GitHub

Diff:
M frontend/lib/resolution/scope-queries.cpp
https://github.com/chapel-lang/chapel/pull/25889.diff