https://bugs.llvm.org/show_bug.cgi?id=46409

            Bug ID: 46409
           Summary: Failure to optimize out strcpy call when passed a
                    parameter that could be evaluated at constant time
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: gabrav...@gmail.com
                CC: llvm-bugs@lists.llvm.org

char *f(void)
{
    char *p = (char *)malloc(1);
    char s[] = "";
    strcpy(p, s);
    return p;
}

The call to strcpy can be omitted her and just replaced by `*p = 0;`. This
transformation is done by GCC, but not by LLVM.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to