[Top][All Lists]

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

bug in GCC 4.4 on sparc64 (was: Re: GNU PSPP 0.6.2pre3 now available)

From: Ben Pfaff
Subject: bug in GCC 4.4 on sparc64 (was: Re: GNU PSPP 0.6.2pre3 now available)
Date: Mon, 06 Jul 2009 22:59:50 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Ben Pfaff <address@hidden> writes:

> I now suspect that this is a problem caused by changes in
> optimization, since float-format.c does some things that should
> be OK but I can imagine a compiler getting wrong (and maybe there
> is some technicality that I have missed so far).  Can you try
> building with "-O0" instead of the default "-O2"?

I found out where GCC 4.4 was installed on the GCC compile farm
and managed to isolate the problem, which indeed appears to be a
bug in GCC.  When the following test program is built with "gcc
-O2 -m64" or "gcc -O3 -fno-inline -m64" using GCC 4.4.0 on
sparc64, it prints 0, but it should print 12345678.

I have filed this in GCC Bugzilla:


#include <stdint.h>
#include <stdio.h>
#include <string.h>

/* Stores 32-bit unsigned integer X at P,
   which need not be aligned. */
static void
put_uint32 (uint32_t x, void *p)
  memcpy (p, &x, sizeof x);

store_12345678 (int type, void *number)
  switch (type)
    case 1:
      printf ("got here\n");
      put_uint32 (0x12345678, number);

    case 7:
      put_uint32 (0, number);
    case 8:
      put_uint32 (0, number);
    case 9:
      put_uint32 (0, number);

main (void)
  uint32_t x;
  store_12345678 (1, &x);
  printf ("%x\n", (unsigned int) x);
  return 0;

Ben Pfaff

reply via email to

[Prev in Thread] Current Thread [Next in Thread]