optimization/5793: optimisation causes an integer comparison to fail when it shouldn't

law@redhat.com law@redhat.com
Wed Mar 6 10:46:00 GMT 2002


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
 



More information about the Gcc-prs mailing list