public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30595]  New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts
@ 2007-01-26  2:32 ISPARRY at BROCADE dot COM
  2007-01-26  3:32 ` [Bug c/30595] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ISPARRY at BROCADE dot COM @ 2007-01-26  2:32 UTC (permalink / raw)
  To: gcc-bugs

The code generated for a ppc32 for the 1 line function f below is incorrect.
Not that it should matter but this is a cross compiler, built with cross-tool.

typedef struct {
        unsigned char c;
        unsigned int i:24;
} e_t;

f(e_t *p)
{
        p->i<<= 8;
}

#include <stdio.h>
int
main(int argc, char *argv[])
{
        e_t x = { .c='a', .i=0x12345 };
        f(&x);
        printf("(0x12345 << 8 ) & 0xffffff = %x\n", x.i);
}

Compiled with "-O".
The output is
(0x12345 << 8 ) & 0xffffff = 234561
The bottom 8 bits should be zero, not the contents of x.c.
If one comments out the driver function, so all that you are left with is the f
function, one gets the following assembler. I have added pseudo-C comments.


        .file   "t.c"
        .section        ".text"
        .align 2
        .globl f
        .type   f, @function
f:
        lwz 9,0(3)                      ;; r9 = *p
        mr 0,9                          ;; r0 = r9
        rlwimi 0,9,8,8,31       ;; low24(r0) = low24(rotate8(r9)) ****** Wrong
        stw 0,0(3)                      ;; *p = r0
        blr                                     ;; return
        .size   f, .-f
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.6"

gcc2.95 generates the correct code, and answer
(0x12345 << 8 ) & 0xffffff = 234500


-- 
           Summary: gcc3.4.6 generates incorrect ppc32 code for combination
                    of bitfields and shifts
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ISPARRY at BROCADE dot COM
 GCC build triplet: i686-host_pc-linux-gnu
  GCC host triplet: i686-host_pc-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595


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

* [Bug c/30595] gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts
  2007-01-26  2:32 [Bug c/30595] New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts ISPARRY at BROCADE dot COM
@ 2007-01-26  3:32 ` pinskia at gcc dot gnu dot org
  2007-07-04 10:34 ` clemens dot koller at anagramm dot de
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-26  3:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595


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

* [Bug c/30595] gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts
  2007-01-26  2:32 [Bug c/30595] New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts ISPARRY at BROCADE dot COM
  2007-01-26  3:32 ` [Bug c/30595] " pinskia at gcc dot gnu dot org
@ 2007-07-04 10:34 ` clemens dot koller at anagramm dot de
  2009-02-06 21:15 ` [Bug middle-end/30595] " steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: clemens dot koller at anagramm dot de @ 2007-07-04 10:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from clemens dot koller at anagramm dot de  2007-07-04 10:34 -------
Cannot reproduce this problem on PPC32 with gcc-4.2.0. The result is
with all -Ox correct: 234500


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595


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

* [Bug middle-end/30595] gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts
  2007-01-26  2:32 [Bug c/30595] New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts ISPARRY at BROCADE dot COM
  2007-01-26  3:32 ` [Bug c/30595] " pinskia at gcc dot gnu dot org
  2007-07-04 10:34 ` clemens dot koller at anagramm dot de
@ 2009-02-06 21:15 ` steven at gcc dot gnu dot org
  2009-02-06 21:25 ` ISPARRY at BROCADE dot COM
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-02-06 21:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from steven at gcc dot gnu dot org  2009-02-06 21:15 -------
Not reproducible, and gcc 3.4 is not supported anymore.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595


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

* [Bug middle-end/30595] gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts
  2007-01-26  2:32 [Bug c/30595] New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts ISPARRY at BROCADE dot COM
                   ` (2 preceding siblings ...)
  2009-02-06 21:15 ` [Bug middle-end/30595] " steven at gcc dot gnu dot org
@ 2009-02-06 21:25 ` ISPARRY at BROCADE dot COM
  2009-02-06 21:32 ` pinskia at gcc dot gnu dot org
  2009-02-06 22:41 ` stevenb dot gcc at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ISPARRY at BROCADE dot COM @ 2009-02-06 21:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ISPARRY at BROCADE dot COM  2009-02-06 21:25 -------
Subject: RE:  gcc3.4.6 generates incorrect ppc32 code for combination of
bitfields and shifts

Whilst I am not complaining about 3.4 not being supported, I think it is
a pretty poor show that you are not able to reproduce it. Did anyone
even try?


> -----Original Message-----
> From: steven at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org] 
> Sent: Friday, February 06, 2009 1:16 PM
> To: Icarus Sparry
> Subject: [Bug middle-end/30595] gcc3.4.6 generates incorrect 
> ppc32 code for combination of bitfields and shifts
> 
> 
> 
> ------- Comment #2 from steven at gcc dot gnu dot org  
> 2009-02-06 21:15 ------- Not reproducible, and gcc 3.4 is not 
> supported anymore.
> 
> 
> -- 
> 
> steven at gcc dot gnu dot org changed:
> 
>            What    |Removed                     |Added
> --------------------------------------------------------------
> --------------
>              Status|UNCONFIRMED                 |RESOLVED
>          Resolution|                            |WONTFIX
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595
> 
> ------- You are receiving this mail because: ------- You 
> reported the bug, or are watching the reporter.
> 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595


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

* [Bug middle-end/30595] gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts
  2007-01-26  2:32 [Bug c/30595] New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts ISPARRY at BROCADE dot COM
                   ` (3 preceding siblings ...)
  2009-02-06 21:25 ` ISPARRY at BROCADE dot COM
@ 2009-02-06 21:32 ` pinskia at gcc dot gnu dot org
  2009-02-06 22:41 ` stevenb dot gcc at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-06 21:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-02-06 21:31 -------
Works with:
gcc version 4.4.0 20090116 (experimental) [trunk revision 143448] (GCC) 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595


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

* [Bug middle-end/30595] gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts
  2007-01-26  2:32 [Bug c/30595] New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts ISPARRY at BROCADE dot COM
                   ` (4 preceding siblings ...)
  2009-02-06 21:32 ` pinskia at gcc dot gnu dot org
@ 2009-02-06 22:41 ` stevenb dot gcc at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: stevenb dot gcc at gmail dot com @ 2009-02-06 22:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from stevenb dot gcc at gmail dot com  2009-02-06 22:40 -------
Subject: Re:  gcc3.4.6 generates incorrect ppc32 code 
        for combination of bitfields and shifts

> Whilst I am not complaining about 3.4 not being supported, I think it is
> a pretty poor show that you are not able to reproduce it. Did anyone
> even try?

Yes, there actually was a duplicate bug report for this, iirc.

We don't do a good communication job in our bug bashing efforts.  It
is, well, just hard, with so many bugs and so few people who are
willing to wade through the long list of bug reports.  I'm sorry about
that...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30595


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

end of thread, other threads:[~2009-02-06 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-26  2:32 [Bug c/30595] New: gcc3.4.6 generates incorrect ppc32 code for combination of bitfields and shifts ISPARRY at BROCADE dot COM
2007-01-26  3:32 ` [Bug c/30595] " pinskia at gcc dot gnu dot org
2007-07-04 10:34 ` clemens dot koller at anagramm dot de
2009-02-06 21:15 ` [Bug middle-end/30595] " steven at gcc dot gnu dot org
2009-02-06 21:25 ` ISPARRY at BROCADE dot COM
2009-02-06 21:32 ` pinskia at gcc dot gnu dot org
2009-02-06 22:41 ` stevenb dot gcc at gmail dot com

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).