Skip to content

Failure to optimize strcpy+strchr of 0 to stpcpy #46488

@GabrielRavier

Description

@GabrielRavier
Bugzilla Link 47144
Version trunk
OS Linux
CC @davidbolvansky,@efriedma-quic

Extended Description

char *f(char *a, const char *b)
{
strcpy(a, b);
return strchr(a, '\0');
}

This can be optimized to return stpcpy(a, b);. This transformation is done by GCC, but not by LLVM.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions