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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I think this is a valid testcase showing that we can't optimize it:

#include<string>
#include<cstdio>
#include<cstring>
int
main()
{
        std::string str="";
        str.push_back (0);
        printf ("%i %i\n", str.length(), strlen (str.c_str()));
        return 0;
}

We could perhaps infer value range of strlen to be str.end()-str.begin()

Reply via email to