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

            Bug ID: 43624
           Summary: strlen calls on non-const char[] not folded
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangb...@nondot.org
          Reporter: ndesaulni...@google.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk, srhi...@google.com

#include <stdio.h>
#include <string.h>
void f(const char *s){
    char foo [] = "hello\n";
    printf("%lu\n", strlen(foo));
    foo[0] = '\0';
    printf("%lu\n", strlen(foo));
}

https://godbolt.org/z/T1m9UM

Looks like GCC nicely determines the strlen at compile time.  Seems nice to
have.

-- 
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