On 05/07/2014 02:04 PM, Richard Biener wrote:

Depends on what "trivially" unreachable is.  Yes,

int main()
{
   if (0)
     foo ();
}

will already be optimized.  But I doubt you want to warn for that
given C++ and templates which often have this kind of specializations.

Precisely.  But optimizing this:

int main()
{
   if (0)
     foo ();
   else
     throw std::logic_error ("error");
   bar ();
}

to:

int main()
{
   throw std::logic_error ("error");
   bar ();
}

would cause the code to issue such unwanted warnings. That's why I need access to these trivial if statements.

--
Florian Weimer / Red Hat Product Security Team

Reply via email to