[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#325131: gcc-4.0: regression on hppa and arm, possibly wrong code



On Fri, Aug 26, 2005 at 02:15:11PM +0200, Max Vozeler wrote:
> On Fri, Aug 26, 2005 at 01:27:43PM +0200, Falk Hueffner wrote:
> > Max Vozeler <xam@debian.org> writes:
> >
> > > I can reproduce the problem in paer's sid chroot (hppa) and have put
> > > gcc-3.4 and gcc-4.0 builds with -save-temps on [1]. If there is
> > > other information that could be useful to you, please let me know.
> >
> > It would be nice to know how to reproduce the problem.
> >
>
> Note sure if this is what you are asking, if you copy the
> 2.3b-gcc-4.0 directory [1] to a hppa machine and run "make tests"
> there it should show the wrong result.

I've been able to find a reduced testcase that shows the problem. You
can find below the results using gcc-3.4 and gcc-4.0 with -O1/-O2 each.
The problem only shows with gcc-4.0 and -O2 on hppa.

  xam@paer:~/testcase7$ make OPT=-O1 CC=gcc-4.0 clean test; ./test
  rm test
  gcc-4.0 -Wall -O1 -g    test.c   -o test
  j=16 x=13aec3aec3aec3ae

  xam@paer:~/testcase7$ make OPT=-O2 CC=gcc-4.0 clean test; ./test
  rm test
  gcc-4.0 -Wall -O2 -g    test.c   -o test
  j=16 x=13aec3aac3aec3ae
                ^

  xam@paer:~/testcase7$ make OPT=-O1 CC=gcc-3.4 clean test; ./test
  rm test
  gcc-3.4 -Wall -O1 -g    test.c   -o test
  j=16 x=13aec3aec3aec3ae

  xam@paer:~/testcase7$ make OPT=-O2 CC=gcc-3.4 clean test; ./test
  rm test
  gcc-3.4 -Wall -O2 -g    test.c   -o test
  j=16 x=13aec3aec3aec3ae
  xam@paer:~/testcase7$ exit

The same tests on my i386 machine gives the correct result
(x=13aec3aec3aec3ae) for each combination of gcc-3.4/gcc-4.0 and -O1/-O2

In case you can see some flaw in the testcase that would explain the
result, please educate me :) It looks OK to my untrained eye and gives
no compiler warnings. 

For reference the exact compiler versions installed on paer:

  $ gcc-4.0 -v
  Using built-in specs.
  Target: hppa-linux-gnu
  Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls --without-included-gettext --enable-threads=posix --program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release hppa-linux-gnu
  Thread model: posix
  gcc version 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)

  $ gcc-3.4 -v
Reading specs from /usr/lib/gcc/hppa-linux-gnu/3.4.5/specs
Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal,objc,ada --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug hppa-linux-gnu
Thread model: posix
gcc version 3.4.5 20050821 (prerelease) (Debian 3.4.4-8)

  $ uname -a
  Linux paer 2.6.12-1-64-smp #1 SMP Wed Aug 10 16:47:43 UTC 2005 parisc64 GNU/Linux

cheers,
Max
CFLAGS = -Wall $(OPT) -g

test:

clean:
	-rm test
#include <stdio.h>
#include <sys/types.h>

#define R(x,y)      ((y) >> (x))
#define S(x,y)      (((y) >> (x)) | ((y) << (64 - (x))))
#define lSig1(x)    ((S(19,(x))) ^ (S(61,(x))) ^ (R(6,(x))))

int main(int argc, char **argv)
{
    u_int64_t W[80], Wm2, x;
    register int j;

    for (j=0; j < 80; j++)
        W[j] = 0x1234123412341234ll;
    
    j = 16;
    Wm2 = W[j - 2];
    x = lSig1(Wm2);

    printf("j=%02d x=%llx\n", j, x);
    return 0;
}


Reply to: