code generation bug in x86 PIC
Ulrich Drepper
drepper@redhat.com
Sat Nov 25 10:52:00 GMT 2000
The current mainline compiler (sources from late 2000-11-14 evening)
produces wrong PIC. The compiler worked fine 3 or 4 days before that.
Preprocessed sources are available at
http://www.cygnus.com/~drepper/backtrace.i.gz
(really small this time). The problem shows up when compiling with
gcc -O -fPIC -c backtrace.i
and it's related to using an uninitialized register. Looking at the
non-PIC one could assume that the necessary movs are optimized out.
00000004 <__backtrace>:
4: 55 push %ebp
5: 89 e5 mov %esp,%ebp
7: 57 push %edi
8: 56 push %esi
9: 53 push %ebx
a: 83 ec 08 sub $0x8,%esp
d: e8 ee ff ff ff call 0 <gcc2_compiled.>
12: 81 c3 02 00 00 00 add $0x2,%ebx
14: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
18: 8b 7d 0c mov 0xc(%ebp),%edi
1b: b9 00 00 00 00 mov $0x0,%ecx
20: 39 f9 cmp %edi,%ecx
22: 7d 38 jge 5c <__backtrace+0x58>
24: 3b 55 f0 cmp 0xfffffff0(%ebp),%edx
[...]
In the last instruction %edx is not initialized.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
More information about the Gcc-bugs
mailing list