]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/tree-ssa-ccp.c
PR middle-end/100684 - spurious -Wnonnull with -O1 on a C++ lambda
[gcc.git] / gcc / tree-ssa-ccp.c
index bf31f03515327ec07dc0351a74c977485d6056e2..3834212b867fe76831ff8ec97ae8cb34c813a046 100644 (file)
@@ -3536,6 +3536,7 @@ pass_post_ipa_warn::execute (function *fun)
            continue;
 
          tree fndecl = gimple_call_fndecl (stmt);
+         const bool closure = fndecl && DECL_LAMBDA_FUNCTION_P (fndecl);
 
          for (unsigned i = 0; i < gimple_call_num_args (stmt); i++)
            {
@@ -3544,6 +3545,9 @@ pass_post_ipa_warn::execute (function *fun)
                continue;
              if (!integer_zerop (arg))
                continue;
+             if (i == 0 && closure)
+               /* Avoid warning for the first argument to lambda functions.  */
+               continue;
              if (!bitmap_empty_p (nonnullargs)
                  && !bitmap_bit_p (nonnullargs, i))
                continue;
This page took 0.028331 seconds and 5 git commands to generate.