[llvm-bugs] [Bug 43624] New: strlen calls on non-const char[] not folded

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 9 09:26:17 PDT 2019


            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: unassignedclangbugs at nondot.org
          Reporter: ndesaulniers at google.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk, srhines at 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));


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

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191009/ec794383/attachment.html>

More information about the llvm-bugs mailing list