From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18058 invoked by alias); 6 Mar 2002 18:46: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 18032 invoked by uid 71); 6 Mar 2002 18:46:01 -0000 Date: Wed, 06 Mar 2002 10:46:00 -0000 Message-ID: <20020306184601.18031.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: law@redhat.com Subject: Re: optimization/5793: optimisation causes an integer comparison to fail when it shouldn't Reply-To: law@redhat.com X-SW-Source: 2002-03/txt/msg00201.txt.bz2 List-Id: The following reply was made to PR optimization/5793; it has been noted by GNATS. From: law@redhat.com To: amorris@providence.org Cc: gcc-gnats@gcc.gnu.org Subject: Re: optimization/5793: optimisation causes an integer comparison to fail when it shouldn't Date: Wed, 06 Mar 2002 11:44:34 -0700 In message <20020228200043.30339.qmail@sources.redhat.com>, amorris@providence. org writes: > > >Number: 5793 > >Category: optimization > >Synopsis: optimisation causes an integer comparison to fail when it s > houldn't > >Confidential: no > >Severity: serious > >Priority: medium > >Responsible: unassigned > >State: open > >Class: wrong-code > >Submitter-Id: net > >Arrival-Date: Thu Feb 28 12:06:00 PST 2002 > >Closed-Date: > >Last-Modified: > >Originator: Adam Morris > >Release: gcc version 3.0.2 > >Organization: > >Environment: > HP-UX11i 64 bit mode on an HP-PA machine. No environment variables set to m > odify gcc > >Description: > When compiled with optimisation an if statement fails when it should succeed > . > > The if statement looks like... > if (-1 == (pPort->sin_addr.s_addr = inet_addr(pcToHost))) > > After the assignment, pPort->sin_addr.s_addr is -1. If a cast to int is pla > ced in front of the assignment then this works with and without optimisation [ ... ] This is closely related to 5169, 5185 and 5264, though slightly different. It works with the current development sources (and I expect the 3.1 branch), but that's more by accident than by design as far as I can tell. Jeff