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 tree-optimization/86936] strlen() of a constant not folded due to laddress transformation


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic,
                   |                            |missed-optimization

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Besides missing out on an optimization opportunity the transformation also
prevents diagnosing strlen() calls with such arguments where the second
argument is greater than the upper bound of the array.  (Issuing the diagnostic
regardless would result in false positives if the referenced element was, in
fact, nul-terminated, as would be the case if a were defined like so: const
char a[][4] = { "12", "123", "1234" };)

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