[llvm-bugs] [Bug 38657] New: Test using strcmp fails after r339410
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 21 01:38:53 PDT 2018
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: unassignedbugs at nondot.org
Reporter: douglas_yung at playstation.sony.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180821/1374f804/attachment.html>
More information about the llvm-bugs
mailing list