[LLVMbugs] [Bug 3829] New: Trivial piece of code misbehaves badly on FreeBSD
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Mar 17 07:29:45 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=3829
Summary: Trivial piece of code misbehaves badly on FreeBSD
Product: clang
Version: unspecified
Platform: PC
OS/Version: FreeBSD
Status: NEW
Severity: major
Priority: P2
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ed at 80386.nl
CC: llvmbugs at cs.uiuc.edu
Blocks: 3696
Created an attachment (id=2720)
--> (http://llvm.org/bugs/attachment.cgi?id=2720)
Testcase
When the attached code is compiled with Clang using -O or higher, something
strange happens. I suspect it's malloc() being called with an impossible value.
hashtabnew() when compiled with -O0:
0000000000000000 <hashtabnew>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 48 83 ec 30 sub $0x30,%rsp
8: 48 89 f0 mov %rsi,%rax
b: 89 f9 mov %edi,%ecx
d: 89 4d f4 mov %ecx,0xfffffffffffffff4(%rbp)
10: 48 89 45 e8 mov %rax,0xffffffffffffffe8(%rbp)
14: 8b 45 f4 mov 0xfffffffffffffff4(%rbp),%eax
17: 83 e8 01 sub $0x1,%eax
1a: 48 63 c0 movslq %eax,%rax
1d: 48 b9 08 00 00 00 00 mov $0x8,%rcx
24: 00 00 00
27: 48 0f af c1 imul %rcx,%rax
2b: 48 89 45 d8 mov %rax,0xffffffffffffffd8(%rbp)
2f: 48 8b 45 d8 mov 0xffffffffffffffd8(%rbp),%rax
33: 48 89 c7 mov %rax,%rdi
36: e8 00 00 00 00 callq 3b <hashtabnew+0x3b>
3b: 48 89 45 e0 mov %rax,0xffffffffffffffe0(%rbp)
3f: 48 8b 45 e0 mov 0xffffffffffffffe0(%rbp),%rax
43: 48 8b 4d e8 mov 0xffffffffffffffe8(%rbp),%rcx
47: 48 89 08 mov %rcx,(%rax)
4a: 48 8b 45 e0 mov 0xffffffffffffffe0(%rbp),%rax
4e: 48 89 45 f8 mov %rax,0xfffffffffffffff8(%rbp)
52: 48 8b 45 f8 mov 0xfffffffffffffff8(%rbp),%rax
56: 48 83 c4 30 add $0x30,%rsp
5a: 5d pop %rbp
5b: c3 retq
5c: 66 data16
5d: 66 data16
5e: 66 data16
5f: 90 nop
hashtabnew() when compiled with -O1:
0000000000000000 <hashtabnew>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 53 push %rbx
5: 48 83 ec 08 sub $0x8,%rsp
9: 48 89 f3 mov %rsi,%rbx
c: 81 c7 ff ff ff 1f add $0x1fffffff,%edi
12: 89 f8 mov %edi,%eax
14: 48 89 c7 mov %rax,%rdi
17: 48 c1 e7 03 shl $0x3,%rdi
1b: e8 00 00 00 00 callq 20 <hashtabnew+0x20>
20: 48 89 18 mov %rbx,(%rax)
23: 48 83 c4 08 add $0x8,%rsp
27: 5b pop %rbx
28: 5d pop %rbp
29: c3 retq
2a: 66 data16
2b: 66 data16
2c: 90 nop
2d: 66 data16
2e: 66 data16
2f: 90 nop
--
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