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

            Bug ID: 38657
           Summary: Test using strcmp fails after r339410
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: douglas_y...@playstation.sony.com
                CC: llvm-bugs@lists.llvm.org

One of our internal tests started to fail after r339410 was committed. Here is
a repro that can demonstrate the problem:

/* test.cpp */
#include <string.h>
#include <assert.h>

struct String {
  char    content[100];
  String (const char* a) {
    strcpy(content, a);
  }
  operator const char* () const {
    return content;
  }
};

int main()
{
  char const* str1 = String("three");
  assert(strcmp(str1, "three") == 0);

  return 0;
}

Next, compile the code using a compiler built from r339410 or newer and with
optimizations enabled (-O2), and when the resulting executing is run, you will
see the following output:

$ clang -O2 test.cpp -o test.out; ./test.out
test.out: test.cpp:17: int main(): Assertion `strcmp(str1, "three") == 0'
failed.

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

Reply via email to