From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33097 invoked by alias); 20 Apr 2015 05:24:40 -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 Received: (qmail 32939 invoked by uid 48); 20 Apr 2015 05:24:31 -0000 From: "amodra at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65810] powerpc64 libgfortran alignment issue? Date: Mon, 20 Apr 2015 05:24:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: amodra at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: amodra at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on assigned_to everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg01575.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65810 Alan Modra changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2015-04-20 Assignee|unassigned at gcc dot gnu.org |amodra at gmail dot com Ever confirmed|0 |1 --- Comment #4 from Alan Modra --- Here's the bad code 0x00000fffb7f6c438 : addis r9,r2,-2 0x00000fffb7f6c43c : li r27,0 0x00000fffb7f6c440 : lfd f24,32760(r9) 0x00000fffb7f6c444 : lfd f25,-32768(r9) It's from write_float.def:888 r *= 10; so is supposed to be loading up 10.0L but instead gets a completely bogus low double as seen in "d" below. __gcc_qmul (a=1, b=0, c=10, d=-7.3968712249802237e+209) So not something odd in libgfortran.. Hmm p/x $r2 $31 = 0xfffb7fa1bd8 So, gcc emits toc sections with alignment of 8 bytes, which the linker respects, leading to a toc pointer (r2) that can only be assumed to be 8 byte aligned. This completely breaks rs6000.c:offsettable_ok_by_alignment. My bug. Short term fix will be to limit offsettable_ok_by_alignment to 8 byte alignment. Longer term, modify the linker to increase r2 alignment.