[LLVMbugs] [Bug 19070] New: Invalid promotion from automatic to static storage

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 6 12:21:01 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=19070

            Bug ID: 19070
           Summary: Invalid promotion from automatic to static storage
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matthew at dempsky.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I believe this program is required to output "0" because it's comparing
pointers to two separate stack allocated objects.  However, compiled with Clang
3.5, it outputs "1" because the const char array is being promoted from
automatic storage to static storage.

#include <iostream>

bool Test(const char *s = 0) {
  const char x[] = "test data";
  return s ? x == s : Test(x);
}

int main() {
  std::cout << Test() << std::endl;
}

-- 
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/20140306/4a9b6ea1/attachment.html>


More information about the llvm-bugs mailing list