From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17002 invoked by alias); 2 Nov 2002 18:07:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 16728 invoked from network); 2 Nov 2002 18:06:57 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 2 Nov 2002 18:06:57 -0000 Received: from hiauly1.hia.nrc.ca (localhost [127.0.0.1]) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id gA2I6uSf016143 for ; Sat, 2 Nov 2002 13:06:56 -0500 (EST) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id gA2I6tDN016141; Sat, 2 Nov 2002 13:06:55 -0500 (EST) Message-Id: <200211021806.gA2I6tDN016141@hiauly1.hia.nrc.ca> Subject: Re: [PATCH] Fix some -Wunreachable-code issues To: gcc-patches@gcc.gnu.org Date: Sat, 02 Nov 2002 10:07:00 -0000 From: "John David Anglin" Cc: jakub@redhat.com, rth@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-11/txt/msg00085.txt.bz2 I have have been working on implementing sibcalls on hppa64-hp-hpux11 and noticed that when sibcalls are enabled, Wunreachable-1.c fails because of an extra warning: /xxx/gnu/gcc-3.3/gcc/gcc/testsuite/gcc.dg/Wunreachable-1.c:12: warning: will never be executed --- gcc/testsuite/gcc.dg/Wunreachable-1.c.jj Tue Feb 12 17:54:33 2002 +++ gcc/testsuite/gcc.dg/Wunreachable-1.c Tue Feb 12 17:53:17 2002 @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wunreachable-code" } */ + +extern void foo (void); +extern void baz (void); + +void bar (int i) +{ + if (i < 2) + { + baz (); + return; This appears to fail because we have a different placement of notes on hppa64-hp-hpux11* (I think because of the pic register restore after calls). This is rtl on hppa64-hp-hpux11: (note 96 20 19 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (insn 19 96 25 2 0000000000000000 (set (reg:DI 27 %r27) (reg:DI 68)) -1 (nil) (nil)) (note 25 19 26 2 ("/xxx/gnu/gcc-3.3/gcc/gcc/testsuite/gcc.dg/Wunreachable-1.c") 12) (jump_insn 26 25 27 2 0000000000000000 (set (pc) (label_ref 87)) -1 (nil) (nil)) "note 96" is the avoided_insn and "jump_insn 26" is the finish insn. On hppa-linux, we have: (note 19 16 74 ("/home/dave/gcc-3.3/gcc/gcc/testsuite/gcc.dg/Wunreachable-1.c") 12) (note 74 19 20 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (jump_insn 20 74 21 2 (nil) (set (pc) (label_ref 65)) -1 (nil) (nil)) Looking at the loop in never_reached_warning, we will have two avoided lines and contains_insn will be true because of insn 19 on hppa64. Possibly, contains_insn should only be set to 1 after seeing the first note? Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605)