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

            Bug ID: 86567
           Summary: [8/9 Regression] -Wnonnull/-Wformat/-Wrestrict affect
                    code generation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---

#include <vector>

std::vector<int>
f()
{
  std::vector<int> r;
  return r;
}

starting with gcc-8 ICEs using 'g++ -fcompare-debug=-Wnonnull' (as well as
Wformat, Wrestrict, Wsuggest-attribute=format)


cp/call.c:build_over_call() has:

  if (warn_nonnull
      || warn_format
      || warn_suggest_attribute_format
      || warn_restrict)
    {
      tree *fargs = (!nargs ? argarray
                            : (tree *) alloca (nargs * sizeof (tree)));
      for (j = 0; j < nargs; j++)
        {
          /* For -Wformat undo the implicit passing by hidden reference
             done by convert_arg_to_ellipsis.  */
          if (TREE_CODE (argarray[j]) == ADDR_EXPR
              && TYPE_REF_P (TREE_TYPE (argarray[j])))
            fargs[j] = TREE_OPERAND (argarray[j], 0);
          else
            fargs[j] = maybe_constant_value (argarray[j]);
        }

      warned_p = check_function_arguments (input_location, fn, TREE_TYPE (fn),
                                           nargs, fargs, NULL);
    }


which if bypassed does not cause the ICE, which indicates that something in the
snippet may affect code generation (not investigating further).

Reply via email to