From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19245 invoked by alias); 12 Nov 2002 14:06:07 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 19224 invoked by uid 71); 12 Nov 2002 14:06:07 -0000 Resent-Date: 12 Nov 2002 14:06:07 -0000 Resent-Message-ID: <20021112140607.19223.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, daveb@ffem.org Received: (qmail 9815 invoked by uid 61); 12 Nov 2002 13:58:31 -0000 Message-Id: <20021112135831.9807.qmail@sources.redhat.com> Date: Tue, 19 Nov 2002 14:36:00 -0000 From: daveb@ffem.org Reply-To: daveb@ffem.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/8546: ebx is not being preserve for inline asm if -fPIC X-SW-Source: 2002-11/txt/msg00580.txt.bz2 List-Id: >Number: 8546 >Category: c >Synopsis: ebx is not being preserve for inline asm if -fPIC >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Nov 12 06:06:05 PST 2002 >Closed-Date: >Last-Modified: >Originator: Dave Benson >Release: gcc-3.0 and gcc-3.2 >Organization: >Environment: intel i386, Debian GNU/Linux >Description: It appears that %ebx is used by gcc to access global variables when -fPIC is specified. Hence %ebx should be preserved if __asm__ inlines add "%ebx" to the clobber list. However, %ebx guards are not being added, so the resulting code has undefined behavior. >How-To-Repeat: just run the attached script, which makes two tiny .c files, compiles, links and runs the result, which segfaults when i do it. >Fix: i don't the proper fix. but a workaround is to push/pop %ebx at the beginning and end of the assembly block. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="bug-script" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug-script" CkdDQz1nY2MtMy4yCgpjYXQgPDwiRU9GIiA+IHQuYwojaW5jbHVkZSA8c3RkaW8uaD4KCnZvbGF0 aWxlIGludCB3aGF0ZXZlciA9IDM7CgppbnQgdGVzdF9saWIoKQp7CiAgZnByaW50ZihzdGRlcnIs IiV1XG4iLCB3aGF0ZXZlcik7CiAgX19hc21fXyBfX3ZvbGF0aWxlICgKICAgICJtb3ZsICQwLCAl JWVieFxuIgogICAgOgogICAgOgogICAgOiAiJWVieCIKICApOwogIGZwcmludGYoc3RkZXJyLCIl dVxuIiwgd2hhdGV2ZXIpOwogIHJldHVybiAwOwp9CkVPRgoKY2F0IDw8RU9GID4gbWFpbi5jCnZv aWQgdGVzdF9saWIoKTsKCmludCBtYWluKCkgeyB0ZXN0X2xpYigpOyByZXR1cm4gMDsgfQpFT0YK CnNldCAtZSAteAokR0NDIC1EX1JFRU5UUkFOVCAtV2FsbCAtcGVkYW50aWMgLWMgdC5jICAtZlBJ QyAtRFBJQyAtbyB0LmxvCiRHQ0MgLXNoYXJlZCAgdC5sbyAgIC1vIGxpYnQuc28KJEdDQyAtRF9S RUVOVFJBTlQgLVdhbGwgLXBlZGFudGljIC1jIG1haW4uYyAgLWZQSUMgLURQSUMgLW8gbWFpbi5v CiRHQ0MgLW8gdHR0IG1haW4ubyBsaWJ0LnNvCgpMRF9MSUJSQVJZX1BBVEg9LiAuL3R0dAo=