[Bug c++/85091] Compiler generates different code depending on whether -Wnonnull -Woverloaded-virtual given or not

amonakov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 27 16:15:00 GMT 2018


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

--- Comment #13 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
> (in the diffs, plus-lines correspond to -Wnonnull added to command line)

No, sorry, it was the other way around. Here's the reverse diff with more
context:

   if (0)
     {
       <<cleanup_point <<< Unknown tree: expr_stmt
   lmi_test::record_error () >>>>>;
     }
-  if (0)
-    {
-      <<cleanup_point <<< Unknown tree: expr_stmt
+  <<cleanup_point <<< Unknown tree: expr_stmt
   lmi_test::record_error () >>>>>;
-    }
 }

It corresponds to

    if(!(!std::signbit(bourn_cast<To>( From(0))))) { lmi_test::record_error();
};
    if(!(std::signbit(bourn_cast<To>(-From(0))))) { lmi_test::record_error();
};

in template instantiation test_floating_conversions<double, float>.
Essentially, with -Wnonnull the second condition seems to be folded to truth
value.


More information about the Gcc-bugs mailing list