[LLVMbugs] [Bug 2341] New: memcmp() optimization is erroneous
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun May 18 16:50:32 PDT 2008
http://llvm.org/bugs/show_bug.cgi?id=2341
Summary: memcmp() optimization is erroneous
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: MacOS X
Status: NEW
Severity: critical
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: scottm at aero.org
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=1651)
--> (http://llvm.org/bugs/attachment.cgi?id=1651)
memcmp() optimization bug test case
After a long haitus on an internal work task, I'm (yet again) building llvm
from bootstrap (Release native compiled llvm -> llvm gcc 4.2 -> Release
llvm-gcc compiled llvm). Found a really good bug that I've been able to narrow
down to a test case.
The offending assembly code is:
movw _.str-"L4$pb"(%esi), %ax
cmpw %ax, _buf-"L4$pb"+4(%esi)
which is comparing two 16-bit words, not two 32-bit words. This allows things
like "code" and "cond" to be memcmp()-ed as equal. This is clearly erroneous.
This is TOT code.
To reproduce: llvm-c++ -O3 testcase.cpp -lstdc++
Output produced is: was_token(buf + 4, 4) = 1
Output should be: was_token(buf + 4, 4) = 0
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list