This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/71315] missing strlen optimization on a POINTER_PLUS expression


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is alias analysis deficiency.  It considers s escaped, because &s[0] is
passed to a function (strlen), but __builtin_strlen really is not allowed to
save the argument into some global var that e.g. the following call to f
function could then use to modify it.

The strlen pass just uses the alias oracle to query if it needs to invalidate
remembered string lengths, in particular on the f () call.  As the alias oracle
considers s to be escaped, it returns that the f () call might change it (which
it indeed could if instead of __builtin_strlen one used some function with the
same prototype, but on which the compiler can't make any assumptions).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]