[Bug lto/47205] New: GCC emits optimized out noinline function

Jan Hubicka hubicka@ucw.cz
Fri Jan 7 12:48:00 GMT 2011


> extern int foo(void);
> 
> int main(void)
> {
>   return foo() * 0;
> }
This is because gimple part of optimizers for some reason leads to the following in the optimized dump:
main ()
{
<bb 2>:
  foo ();
  return 0;

}
and only RTL optimizers do the trick.  
This is weird since pure/const detect function as pure (seen in pure-const dump)

Read info for foo/2  const nothrow
  pure const state: const
  previously known state: const

but tree-ssa-dce apparently fails to remove the statement.  I guess it is
confused by lack of return value.  I will take a look.  But this is
tree-optimization bug.

Honza



More information about the Gcc-bugs mailing list