From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7482 invoked by alias); 6 Jul 2004 14:55:35 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7466 invoked by uid 48); 6 Jul 2004 14:55:34 -0000 Date: Tue, 06 Jul 2004 14:55:00 -0000 Message-ID: <20040706145534.7463.qmail@sourceware.org> From: "thutt at vmware dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040702165134.16331.thutt@vmware.com> References: <20040702165134.16331.thutt@vmware.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/16331] x86-64 inline asm register constraints insufficient WRT ABI X-Bugzilla-Reason: CC X-SW-Source: 2004-07/txt/msg00477.txt.bz2 List-Id: ------- Additional Comments From thutt at vmware dot com 2004-07-06 14:55 ------- Could you reference the documentation defect number? And, I'm not sure that just the documentation is wrong; consider: extern int hokus(void); void test(void) { register int r8 asm("r8") = hokus(); register int r9 asm("r9") = 6; __asm__ __volatile__("call pokus" : : "D" (r8), "S" (2), "d" (3), "c" (4), "r" (r8), "r" (r9) ); r8 = hokus(); pokus(r8, 2, 3, 4, 5, 6); } 0000000000000000 : 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: e8 00 00 00 00 callq 9 5: R_X86_64_PC32 hokus+0xfffffffffffffffc 9: 41 b9 06 00 00 00 mov $0x6,%r9d f: 41 b8 05 00 00 00 mov $0x5,%r8d 15: b9 04 00 00 00 mov $0x4,%ecx 1a: ba 03 00 00 00 mov $0x3,%edx 1f: be 02 00 00 00 mov $0x2,%esi 24: 44 89 c7 mov %r8d,%edi 27: b8 00 00 00 00 mov $0x0,%eax 2c: e8 00 00 00 00 callq 31 2d: R_X86_64_PC32 pokus+0xfffffffffffffffc 31: be 02 00 00 00 mov $0x2,%esi 36: ba 03 00 00 00 mov $0x3,%edx 3b: b9 04 00 00 00 mov $0x4,%ecx 40: 44 89 c7 mov %r8d,%edi 43: e8 00 00 00 00 callq 48 44: R_X86_64_PC32 pokus+0xfffffffffffffffc 48: c9 leaveq 49: c3 retq The first call of pokus() completely ignores the assigned value of the variable r8 -- instead the value '6' into it for the call. The second call assumes the the register r8 should be used for the call, but by now the wrong value has bee placed into it. Perhaps the documentation is wrong, but so is the code generated. I'm reopening. -- What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16331