From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24044 invoked by alias); 23 Dec 2010 18:05:13 -0000 Received: (qmail 24034 invoked by uid 22791); 23 Dec 2010 18:05:12 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CP,TW_OV X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Dec 2010 18:05:08 +0000 From: "changpeng.fang at amd dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug regression/47037] 465.tonto Segmentation Fault in memset with -fcaller-saves (default at -O2 or higher) X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: regression X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: changpeng.fang at amd dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 23 Dec 2010 18:05:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-12/txt/msg02577.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037 Changpeng Fang 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 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,