* [Bug regression/47037] 465.tonto Segmentation Fault in memset
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
@ 2010-12-22 0:55 ` changpeng.fang at amd dot com
2010-12-23 9:14 ` tkoenig at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: changpeng.fang at amd dot com @ 2010-12-22 0:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
--- Comment #1 from Changpeng Fang <changpeng.fang at amd dot com> 2010-12-22 00:55:35 UTC ---
Initially I thought it is a glibc bug, but seems it is not:
(1) A workaround flag is -fno-caller-saves
(2) The compile binary (NOTE: with -static) runs correctly on other systems
The bad code is in atom.fppized:
subroutine set_label_and_atomic_number(self,label)
type(atom_type) :: self
!Set an type(atom_type) "label" and extract the atomic number from it.
character(*) :: label
integer(kind=kind(1)) :: lensym,z
character(128) :: symbol
logical(kind=kind(.true.)) :: error
self%label = label
The memset is for the label copy:
.LBB633:
.loc 1 967 0 discriminator 2
movq %r13, %rdx
movq %rbx, %rsi
movq %rsp, %rdi
call memcpy
movl $128, %edx
leaq (%rsp,%r13), %rdi ## <---- bad address
movl $32, %esi
subq %r13, %rdx
movq %rsp, %r12
call memset
jmp .L707
.LVL646:
.p2align 4,,10
.p2align 3
.L717:
Looks like %rsp value is not correct (stack corrupted).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
2010-12-22 0:55 ` [Bug regression/47037] " changpeng.fang at amd dot com
@ 2010-12-23 9:14 ` tkoenig at gcc dot gnu.org
2010-12-23 18:05 ` [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher) changpeng.fang at amd dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-23 9:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu.org
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-23 09:13:59 UTC ---
Can you supply a simplified test case?
This might be a gfortran bug, but it's hard to tell.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher)
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
2010-12-22 0:55 ` [Bug regression/47037] " changpeng.fang at amd dot com
2010-12-23 9:14 ` tkoenig at gcc dot gnu.org
@ 2010-12-23 18:05 ` changpeng.fang at amd dot com
2010-12-23 18:09 ` changpeng.fang at amd dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: changpeng.fang at amd dot com @ 2010-12-23 18:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
Changpeng Fang <changpeng.fang at amd dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|465.tonto Segmentation |465.tonto Segmentation
|Fault in memset |Fault in memset with
| |-fcaller-saves (default at
| |-O2 or higher)
--- Comment #3 from Changpeng Fang <changpeng.fang at amd dot com> 2010-12-23 18:05:02 UTC ---
.LBB633:
.loc 1 967 0 discriminator 2
movq %r13, %rdx
movq %rbx, %rsi
movq %rsp, %rdi
call memcpy
movl $128, %edx
leaq (%rsp,%r13), %rdi ## <---- bad address
movl $32, %esi
subq %r13, %rdx
movq %rsp, %r12
call memset
jmp .L707
.LVL646:
.p2align 4,,10
.p2align 3
Actually, the segfault is in copying label to symbol at line 967:
character(128) :: symbol
symbol = label(1:lensym)
The memset is to set the remainder of the 128 bytes to ZEROs. The local code
seems
good to me. It might be that the %rsp is not appropriately set. Anyway, it is
not likely to be a fortran bug because it only occurs at -O2 or higher when
-fcaller-saves is turned on,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher)
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
` (2 preceding siblings ...)
2010-12-23 18:05 ` [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher) changpeng.fang at amd dot com
@ 2010-12-23 18:09 ` changpeng.fang at amd dot com
2010-12-28 16:07 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: changpeng.fang at amd dot com @ 2010-12-23 18:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
--- Comment #4 from Changpeng Fang <changpeng.fang at amd dot com> 2010-12-23 18:08:44 UTC ---
(In reply to comment #2)
> Can you supply a simplified test case?
>
The difficulty is that the bug only shows up on a new AMD system (bobcat). The
compiled binary on bobcat can run correctly on other systems.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher)
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
` (3 preceding siblings ...)
2010-12-23 18:09 ` changpeng.fang at amd dot com
@ 2010-12-28 16:07 ` rguenth at gcc dot gnu.org
2011-01-03 22:00 ` changpeng.fang at amd dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-28 16:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2010.12.28 16:06:39
Ever Confirmed|0 |1
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-28 16:06:39 UTC ---
Does your glibc have CPU specific optimizations?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher)
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
` (4 preceding siblings ...)
2010-12-28 16:07 ` rguenth at gcc dot gnu.org
@ 2011-01-03 22:00 ` changpeng.fang at amd dot com
2011-01-03 22:04 ` hjl.tools at gmail dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: changpeng.fang at amd dot com @ 2011-01-03 22:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
--- Comment #6 from Changpeng Fang <changpeng.fang at amd dot com> 2011-01-03 21:59:44 UTC ---
(In reply to comment #5)
> Does your glibc have CPU specific optimizations?
I don't think so.
The OS is SLES 11, SP1. The machine (bobcat) indeed does not
support some instructions that K8 supports.
gcc (4.3, coming up with the systems) works fine.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher)
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
` (5 preceding siblings ...)
2011-01-03 22:00 ` changpeng.fang at amd dot com
@ 2011-01-03 22:04 ` hjl.tools at gmail dot com
2011-01-03 22:30 ` changpeng.fang at amd dot com
2012-02-02 8:13 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2011-01-03 22:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-03 22:04:06 UTC ---
(In reply to comment #6)
> The OS is SLES 11, SP1. The machine (bobcat) indeed does not
> support some instructions that K8 supports.
>
Which instructions are missing in Bobcat?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher)
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
` (6 preceding siblings ...)
2011-01-03 22:04 ` hjl.tools at gmail dot com
@ 2011-01-03 22:30 ` changpeng.fang at amd dot com
2012-02-02 8:13 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: changpeng.fang at amd dot com @ 2011-01-03 22:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
--- Comment #8 from Changpeng Fang <changpeng.fang at amd dot com> 2011-01-03 22:30:22 UTC ---
>
> Which instructions are missing in Bobcat?
At least 3DNow instructions.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher)
2010-12-22 0:44 [Bug regression/47037] New: 465.tonto Segmentation Fault in memset changpeng.fang at amd dot com
` (7 preceding siblings ...)
2011-01-03 22:30 ` changpeng.fang at amd dot com
@ 2012-02-02 8:13 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-02 8:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-02 08:12:54 UTC ---
Does this work now?
^ permalink raw reply [flat|nested] 10+ messages in thread