From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 543 invoked by alias); 21 Jan 2003 14:16:02 -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 397 invoked by uid 71); 21 Jan 2003 14:16:02 -0000 Resent-Date: 21 Jan 2003 14:16:02 -0000 Resent-Message-ID: <20030121141602.395.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, m.hayes@elec.canterbury.ac.nz Resent-Reply-To: gcc-gnats@gcc.gnu.org, Svein.Seldal@solidas.com Received: (qmail 24908 invoked by uid 48); 21 Jan 2003 14:13:59 -0000 Message-Id: <20030121141359.24906.qmail@sources.redhat.com> Date: Tue, 21 Jan 2003 14:16:00 -0000 From: Svein.Seldal@solidas.com Reply-To: Svein.Seldal@solidas.com To: gcc-gnats@gcc.gnu.org Cc: m.hayes@elec.canterbury.ac.nz X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: m.hayes@elec.canterbury.ac.nz Subject: optimization/9387: jump threading bug X-SW-Source: 2003-01/txt/msg01144.txt.bz2 List-Id: >Number: 9387 >Category: optimization >Synopsis: jump threading bug >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Jan 21 14:16:02 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Svein.Seldal@solidas.com >Release: gcc: gcc-3_3-branch checked out 20030118, compiled for target tic4x >Organization: >Environment: Cygwin 1.3.15 with gcc 3.2.1, binutils 2.13.2 >Description: Compilation of the following code generates invalid code. I compile the code with "tic4x-gcc -O2 -g -c gcc_bug.c -o gcc_bug.o". The code executes the first "if" block conditionally (which is OK). But the second one is executed regardless of the value of tc. According to the maintainer, the RTL emit is OK, so this is a bug in the jump threading code. I am not able to provoke this error on i386 host native, nor the AVR target. CODE: ----- typedef unsigned int uint; typedef struct _Task { uint Context[33]; struct _Task *Next; } Task; extern Task *CurrentTask; extern Task *_TaskHead; Task *_GetNextTask(Task *tc) { if(tc) { tc = CurrentTask->Next; } if(!tc) { tc = _TaskHead; } return tc; } >How-To-Repeat: tic4x-gcc -O2 -g -c gcc_bug.c -o gcc_bug.o >Fix: Either compile the code without the -O2 option or use the -fno-thread-jumps option: tic4x-gcc -O2 -g -c gcc_bug.c -o gcc_bug.o -fno-thread-jumps >Release-Note: >Audit-Trail: >Unformatted: