From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9898 invoked by alias); 11 Oct 2010 19:18:59 -0000 Received: (qmail 9888 invoked by uid 22791); 11 Oct 2010 19:18:59 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID,TW_BJ 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; Mon, 11 Oct 2010 19:18:57 +0000 From: "siarhei.siamashka at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/32820] optimizer malfunction when mixed with asm statements X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siarhei.siamashka at gmail dot com X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC 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: Mon, 11 Oct 2010 19:18: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-10/txt/msg00929.txt.bz2 Message-ID: <20101011191800.6TJrdDY5JuH39R9HwOVzEDJ82XqLAR85revA52HXP58@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32820 Siarhei Siamashka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |siarhei.siamashka at gmail | |dot com --- Comment #7 from Siarhei Siamashka 2010-10-11 19:18:46 UTC --- Looks like this or similar "Variables in Specified Registers" bug is also reproducible on ARM with gcc 4.5.1 $ cat test.c int f(int a) { register int result asm("r0"); asm ( "add r0, %[a], #123\n" : [result] "=&r" (result) : [a] "r" (a) ); return result; } $ gcc -O2 -c test.c $ objdump -d test.o 00000000 : 0: e280007b add r0, r0, #123 ; 0x7b 4: e1a00003 mov r0, r3 8: e12fff1e bx lr Here the local variable 'result' gets assigned to register r3 instead of r0 causing all kind of problems.