From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24381 invoked by alias); 14 Mar 2013 20:01:28 -0000 Received: (qmail 23663 invoked by uid 48); 14 Mar 2013 20:00:58 -0000 From: "auc42 at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/56621] Misaligned stack with inline assembly Date: Thu, 14 Mar 2013 20:01:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: inline-asm X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: auc42 at yahoo dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: 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 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: 2013-03/txt/msg01100.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56621 --- Comment #2 from auc42 at yahoo dot com 2013-03-14 20:00:56 UTC --- Ah, I had forgotten to change "tmp" back to a long in the code snippet provided. I was experimenting to see variations of the generated assembly while using different types. The failure is present with both the 8-byte long and 4-byte int, in this case. I accept your explanation about the clobbered registers, though. I apparently misunderstood how clobber declarations worked (and in re-reading the manual, either I'm still missing something or the text isn't very clear). Placing the variables directly in the S and d registers and skipping the movX instructions eliminates the problem. I suppose that the sequence only worked by happenstance in earlier versions of gcc. (As for the reason of doing it this way: the original code was avoiding use of the C standard library and/or any include files, as a personal learning exercise toward a later program.)