spu-gcc -O2 behaving wrong on PS3

Bug #285186 reported by Simon Wunderlich
2
Affects Status Importance Assigned to Milestone
cell-gcc (Ubuntu)
Fix Released
Undecided
Dan Munckton

Bug Description

Binary package hint: spu-gcc

Following program behaves incorrectly when compiled with -O1 or -O2 (-O0 and -O3 shows correct behaviour).

----
#include <stdio.h>
#include <stdlib.h>

struct mystruct_t {
 int dimension;
};

struct mystruct_t *s;

void foo (void)
{
  printf("dimension = %d (should be 1)\n", s->dimension);
}

int main (void)
{
 s = malloc(sizeof(struct mystruct_t));
 s->dimension = 1;
 foo();
 return 0;
}
----
dotslash@paul:~/msrc$ spu-gcc -O0 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
nd = 1 (should be 1)
dotslash@paul:~/msrc$ spu-gcc -O1 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
nd = 0 (should be 1)
dotslash@paul:~/msrc$ spu-gcc -O2 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
nd = 0 (should be 1)
dotslash@paul:~/msrc$ spu-gcc -O3 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
nd = 1 (should be 1)

system information:
Playstation 3

dotslash@paul:~/msrc$ lsb_release -rd
Description: Ubuntu 7.10
Release: 7.10

dotslash@paul:~/msrc$ which spu-gcc
/usr/bin/spu-gcc

dotslash@paul:~/msrc$ apt-cache policy spu-gcc
spu-gcc:
  Installed: 4.1.1r840-0ubuntu7
  Candidate: 4.1.1r840-0ubuntu7
  Version table:
 *** 4.1.1r840-0ubuntu7 0
        500 http://ports.ubuntu.com gutsy/universe Packages
        100 /var/lib/dpkg/status

Revision history for this message
Dan Munckton (munckfish) wrote :

Could you try using the updated cell-gcc packages from our PPA here ...

https://launchpad.net/~ubuntu-ps3-dev/+archive

... and see if that makes the problem go away?

You may have to build the debs yourself to get these to install on 7.10 as they're built for hardy and intrepid only I'm afraid.

Revision history for this message
Simon Wunderlich (l-launchpad-packetmixer-de) wrote :

Hello,

thanks for your prompt answer!

I built the packages from the ppa2 dsc file for the ppc architecture (only i386 and amd64 packages were available) on the PS3 and installed all of them. Unfortunately the bug is still present.

dotslash@paul:~/msrc$ spu-gcc -O2 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
dim = 0 (should be 1)

dotslash@paul:~/msrc$ apt-cache policy spu-gcc
spu-gcc:
  Installed: 4.1.1r886-0ubuntu1~ppa2
  Candidate: 4.1.1r886-0ubuntu1~ppa2
  Version table:
 *** 4.1.1r886-0ubuntu1~ppa2 0
        100 /var/lib/dpkg/status
     4.1.1r840-0ubuntu7 0
        500 http://ports.ubuntu.com gutsy/universe Packages

best regards,
     Simon

Revision history for this message
Dan Munckton (munckfish) wrote :

Right, well the next thing to try is gcc-4.3. However this is new to Intrepid, I'm not sure how much foot work you'd need to do to test it on Feisty.

gcc-4.3 now includes all the SPU and PPU related patches and pretty much makes the cell-gcc packages redundant.

Last week I would have advised upgrading to Intrepid to test it, however, this week there are some teething troubles with X, so you may want to try and build it on Feisty first.

Revision history for this message
Simon Wunderlich (l-launchpad-packetmixer-de) wrote :

Hey,

building gcc-4.3 on feisty looked like a lot of footwork, and as i don't use the X-server i upgraded to Intrepid. This was also quite some footwork, with dependency cycles among other nasty things. ;(

However, gcc-4.3 seems to have this bug fixed. :)

dotslash@paul:~/msrc$ spu-gcc-4.3 -O0 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
dim = 1 (should be 1)
dotslash@paul:~/msrc$ spu-gcc-4.3 -O1 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
dim = 1 (should be 1)
dotslash@paul:~/msrc$ spu-gcc-4.3 -O2 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
dim = 1 (should be 1)
dotslash@paul:~/msrc$ spu-gcc-4.3 -O3 spu-gcc-bug.c -o spu-gcc-bug && ./spu-gcc-bug
dim = 1 (should be 1)

dotslash@paul:~/msrc$ apt-cache policy gcc-4.3-spu
gcc-4.3-spu:
  Installed: 4.3.2-1ubuntu10
  Candidate: 4.3.2-1ubuntu10
  Version table:
 *** 4.3.2-1ubuntu10 0
        500 http://ports.ubuntu.com intrepid/main Packages
        100 /var/lib/dpkg/status

dotslash@paul:~/msrc$ lsb_release -rd
Description: Ubuntu intrepid (development branch)
Release: 8.10

Revision history for this message
Dan Munckton (munckfish) wrote :

Fixed in gcc-4.3, therefore, won't fix in cell-gcc.

Changed in cell-gcc:
assignee: nobody → munckfish
status: New → Invalid
status: Invalid → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.