This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/86936] strlen() of a constant not folded due to laddress transformation
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Aug 2018 15:02:23 +0000
- Subject: [Bug tree-optimization/86936] strlen() of a constant not folded due to laddress transformation
- Auto-submitted: auto-generated
- References: <bug-86936-4@http.gcc.gnu.org/bugzilla/>
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" };)