This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/4214: powerpc64: wrong code from optimized mask and shift



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]