From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16715 invoked by alias); 16 Aug 2006 05:20:13 -0000 Received: (qmail 16663 invoked by uid 48); 16 Aug 2006 05:20:02 -0000 Date: Wed, 16 Aug 2006 05:20:00 -0000 Subject: [Bug c/28749] New: Miscompilation of glibc/stdio-common/vfprintf.c X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "carlos at systemhalted dot org" 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 X-SW-Source: 2006-08/txt/msg01211.txt.bz2 List-Id: This is a regression since 4.1 and 4.0 compile vfprintf.c correctly. I am using gcc trunk to build libc / libc-ports head. I have a regression in tst-printfsz which is part of the glibc testsuite. The problem is a miscompilation of glibc/stdio-common/vfprintf.c by GCC. The bug is as follows: Location 1 jumps to location 2. Compiler moves first insn at location 2 to location 1's branch delay slot. Location 3 computes a goto to location 2. Because the first insn at location 2 was moved, the program now crashes. The concrete debugging example: The first insn "ldil L%4000,r21" is moved to location 1's branch delay slot. Location 3: 468cc: ea a0 c0 02 bv,n r0(r21) r21 == (0x403d3000 + 0x4928c) and is part of "goto *ptr" Location 1: 478b4: 82 9c 93 a4 cmpb,<< ret0,r20,4928c <_IO_vfprintf+0x322c> 478b8: 22 a2 00 00 ldil L%4000,r21 Location 2: 4928c: 36 b5 0a d9 ldo -1a94(r21),r21 49290: 08 75 0a 15 add,l r21,r3,r21 49294: 0e a0 10 95 ldw 0(r21),r21 49298: 92 a0 30 00 cmpiclr,<> 0,r21,r0 4929c: e8 1e 0f 45 b,l 46a44 <_IO_vfprintf+0x9e4>,r0 492a0: 34 15 3f ff ldi -1,r21 The code at location 3 jumps to location 2, and does not execute the required "ldil L%4000,r21" The computed goto should create edges to all the label addresses taken by &&, and that should prevent the branch delay slot from fill from occuring. I am recompiling glibc with CFLAGS-vfprintf.c += -fno-delayed-branch to see if it passes the tst-printfsz test. How should I proceed on this issue? I have tried to create a testcase, but I haven't been successfull. -- Summary: Miscompilation of glibc/stdio-common/vfprintf.c Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: carlos at systemhalted dot org GCC build triplet: hppa-linux GCC host triplet: hppa-linux GCC target triplet: hppa-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28749