http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47255

Paolo Bonzini <bonzini at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org

--- Comment #4 from Paolo Bonzini <bonzini at gnu dot org> 2011-02-07 10:57:54 
UTC ---
I think this is invalid.  const attributes are a hint to GCC regarding parts of
the program that it cannot see, but IMHO the const/pure/nothrow on a function
that is static and a leaf should have no effect on code generation (since GCC
can infer just as much).

So, in the first example GCC is "fixing" a wrong usage of const on part of the
program.

In the second example attached, there is no use of syscalls and GCC properly
optimizes out square2 and square3.  If syscalls were added, the bug would be
about missed attributes on the syscalls.  BTW, getgid, getuid etc. are pure but
not const.

Reply via email to