public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/4214: powerpc64: wrong code from optimized mask and shift
@ 2001-09-03 16:46 Kevin Ryde
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Ryde @ 2001-09-03 16:46 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4214
>Category:       c
>Synopsis:       powerpc64: wrong code from optimized mask and shift
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 03 16:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0
>Organization:
>Environment:
System: AIX panther 3 4 000785504C00
host: powerpc-ibm-aix4.3.2.0
build: powerpc-ibm-aix4.3.2.0
target: powerpc-ibm-aix4.3.2.0
configured with: ../gcc-3.0/configure 

>Description:
A certain mask and shift combination produces a wrong answer when
compiled with optimization.

>How-To-Repeat:
A program foo.c,

        int n = 3;

        int
        main (void)
        {
          printf ("%d\n", (n & 2) << 1);
          return 0;
        }

when compiled with

        gcc -O -maix64 -mpowerpc64 foo.c

and run just as "./a.out", prints 6 whereas I think it should print 4
(and which it does if compiled without the -O).

For what it's worth, it seems this only happens under "-maix64
-mpowerpc64", not in 32-bit mode.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c/4214: powerpc64: wrong code from optimized mask and shift
@ 2001-09-24 14:52 dje
  0 siblings, 0 replies; 4+ messages in thread
From: dje @ 2001-09-24 14:52 UTC (permalink / raw)
  To: amodra, gcc-bugs, gcc-prs, nobody, user42

Synopsis: powerpc64: wrong code from optimized mask and shift

Responsible-Changed-From-To: unassigned->amodra
Responsible-Changed-By: dje
Responsible-Changed-When: Mon Sep 24 14:52:54 2001
Responsible-Changed-Why:
    PowerPC
State-Changed-From-To: open->closed
State-Changed-By: dje
State-Changed-When: Mon Sep 24 14:52:54 2001
State-Changed-Why:
    Fixed in gcc-3.0.2 and gcc-3.1

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4214&database=gcc


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c/4214: powerpc64: wrong code from optimized mask and shift
@ 2001-09-03 20:06 Mark Mitchell
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Mitchell @ 2001-09-03 20:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/4214; it has been noted by GNATS.

From: Mark Mitchell <mark@codesourcery.com>
To: Alan Modra <amodra@bigpond.net.au>, Kevin Ryde <user42@zip.com.au>
Cc: "gcc-gnats@gcc.gnu.org" <gcc-gnats@gcc.gnu.org>,
        David Edelsohn <dje@watson.ibm.com>
Subject: Re: c/4214: powerpc64: wrong code from optimized mask and shift
Date: Mon, 03 Sep 2001 19:56:41 -0700

 > Is the patch OK for the branch Mark?
 
 It's fine by me, but I'd like David's thoughts.  David, unless this
 patch makes you nervous, would you approve it?
 
 --
 Mark Mitchell                   mark@codesourcery.com
 CodeSourcery, LLC               http://www.codesourcery.com
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c/4214: powerpc64: wrong code from optimized mask and shift
@ 2001-09-03 19:26 Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2001-09-03 19:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/4214; it has been noted by GNATS.

From: Alan Modra <amodra@bigpond.net.au>
To: Kevin Ryde <user42@zip.com.au>, mark@codesourcery.com
Cc: gcc-gnats@gcc.gnu.org, David Edelsohn <dje@watson.ibm.com>
Subject: Re: c/4214: powerpc64: wrong code from optimized mask and shift
Date: Tue, 4 Sep 2001 11:51:06 +0930

 On Tue, Sep 04, 2001 at 09:39:45AM +1000, Kevin Ryde wrote:
 > 
 > A certain mask and shift combination produces a wrong answer when
 > compiled with optimization.
 > 
 > >How-To-Repeat:
 > A program foo.c,
 > 
 >         int n = 3;
 > 
 >         int
 >         main (void)
 >         {
 >           printf ("%d\n", (n & 2) << 1);
 >           return 0;
 >         }
 
 Fixed by http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01493.html ,
 which I applied to mainline.
 
 Is the patch OK for the branch Mark?  You could argue that it contains
 optimisations (extra patterns for rldicr, no bit-shifting loops) as well
 as the bugfix for rldic, but I'm far more likely to make an error if I
 try to split the patch rather than apply the lot.  ;-)
 
 Alan
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-09-24 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-03 16:46 c/4214: powerpc64: wrong code from optimized mask and shift Kevin Ryde
2001-09-03 19:26 Alan Modra
2001-09-03 20:06 Mark Mitchell
2001-09-24 14:52 dje

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).