This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/38902] [4.3 Regression] __builtin_strcpy doesn't work with -fstack-protector
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2009 19:30:33 -0000
- Subject: [Bug target/38902] [4.3 Regression] __builtin_strcpy doesn't work with -fstack-protector
- References: <bug-38902-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from hjl dot tools at gmail dot com 2009-01-19 19:30 -------
The problem is x86 doesn't set the memory size correct for rep_stos.
Gcc 4.3.3 gave:
(gdb) call debug_rtx (destmem)
(mem/s/c:BLK (reg:DI 59) [3 buffer+8 S1 A64])
(gdb)
Jakub's patch corrected it to
(gdb) call debug_rtx (destmem)
(mem/s/c:BLK (reg:DI 59) [0 buffer+8 S1016 A64])
(gdb)
Since scheduler thinks the size of memory is 1, it changed
(insn:HI 13 12 15 2 x.c:5 (parallel [
(set (reg:DI 2 cx [62])
(const_int 0 [0x0]))
(set (reg:DI 5 di [59])
(plus:DI (ashift:DI (reg:DI 2 cx [62])
(const_int 3 [0x3]))
(reg:DI 5 di [59])))
(set (mem/s/c:BLK (reg:DI 5 di [59]) [3 buffer+8 S1 A64])
(const_int 0 [0x0]))
(use (reg:DI 0 ax [60]))
(use (reg:DI 2 cx [62]))
]) 801 {*rep_stosdi_rex64} (expr_list:REG_DEAD (reg:DI 0 ax [60])
(expr_list:REG_UNUSED (reg:DI 5 di [59])
(expr_list:REG_UNUSED (reg:DI 2 cx [62])
(nil)))))
...
(insn:HI 22 65 24 2 x.c:6 (set (mem/s/c:HI (plus:DI (reg/f:DI 7 sp)
(const_int 24 [0x18])) [0 buffer+24 S2 A64])
(const_int 111 [0x6f])) 53 {*movhi_1} (nil)
into
(insn:HI 22 65 24 2 x.c:6 (set (mem/s/c:HI (plus:DI (reg/f:DI 7 sp)
(const_int 24 [0x18])) [0 buffer+24 S2 A64])
(const_int 111 [0x6f])) 53 {*movhi_1} (nil)
...
(insn:TI 13 22 68 2 x.c:5 (parallel [
(set (reg:DI 2 cx [62])
(const_int 0 [0x0]))
(set (reg:DI 5 di [59])
(plus:DI (ashift:DI (reg:DI 2 cx [62])
(const_int 3 [0x3]))
(reg:DI 5 di [59])))
(set (mem/s/c:BLK (reg:DI 5 di [59]) [3 buffer+8 S1 A64])
(const_int 0 [0x0]))
(use (reg:DI 0 ax [60]))
(use (reg:DI 2 cx [62]))
]) 801 {*rep_stosdi_rex64} (expr_list:REG_DEAD (reg:DI 0 ax [60])
(expr_list:REG_UNUSED (reg:DI 5 di [59])
(expr_list:REG_UNUSED (reg:DI 2 cx [62])
(nil)))))
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38902