From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125442 invoked by alias); 31 Mar 2015 13:45:54 -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 125176 invoked by uid 48); 31 Mar 2015 13:45:50 -0000 From: "mjh at edg dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/65640] New: multiple alternative constraints and earlyclobbers Date: Tue, 31 Mar 2015 14:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: inline-asm X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjh at edg 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-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: 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-03/txt/msg03529.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65640 Bug ID: 65640 Summary: multiple alternative constraints and earlyclobbers Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm Assignee: unassigned at gcc dot gnu.org Reporter: mjh at edg dot com There seems to be an issue with earlyclobbers and multiple alternative constraints. Take this example: int f(int out, int in) { asm("foo %1,%0;" : "=&a" (out) : "b" (in)); // Okay asm("foo %1,%0;" : "=&b" (out) : "b" (in)); // Expected error asm("foo %1,%0;" : "=&a" (out) : "a" (in)); // Expected error asm("foo %1,%0;" : "=&a,&b" (out) : "b,b" (in)); // Okay asm("foo %1,%0;" : "=&a,&b" (out) : "a,a" (in)); // Unexpected error asm("foo %1,%0;" : "=&b,&a" (out) : "b,b" (in)); // Okay asm("foo %1,%0;" : "=&b,&a" (out) : "a,a" (in)); // Okay return out; } With 4.9.2, I see three errors: $ g++492 -S ex.c ex.c: In function 'int f(int, int)': ex.c:3:47: error: 'asm' operand has impossible constraints asm("foo %1,%0;" : "=&b" (out) : "b" (in)); // Expected error ^ ex.c:4:47: error: 'asm' operand has impossible constraints asm("foo %1,%0;" : "=&a" (out) : "a" (in)); // Expected error ^ ex.c:6:52: error: 'asm' operand has impossible constraints asm("foo %1,%0;" : "=&a,&b" (out) : "a,a" (in)); // Unexpected error ^ The first two are expected, but I'm at a loss to explain the third error. In all four of the multi alternative constrain cases, there is exactly one "good" constraint and one "bad" constraint in the pair, yet only one of the four cases is diagnosed. What is the expected behavior for this case?