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

Bug#488563: marked as done ([powerpc] Optimisation results in wrong code)



Your message dated Sun, 29 Jun 2008 22:25:56 +0200
with message-id <20080629202556.GA29569@wavehammer.waldi.eu.org>
and subject line Re: Bug#488563: [powerpc] Optimisation results in wrong code
has caused the Debian Bug report #488563,
regarding [powerpc] Optimisation results in wrong code
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
488563: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=488563
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: gcc-4.3
Version: 4.3.1-2
Severity: serious

When using the following (somewhat contrived code):
------
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

void
misc (uint8_t **header)
{
  uint8_t *h;

  h = malloc(8);

  *((uint64_t *) h) = (uint64_t) 0;
  *((uint32_t *) h) = (uint32_t) 0xffffffff;

  *header = h;
}

int
main(int argc, char **argv)
{
  uint8_t *h;

  misc (&h);

  printf ("%x\n", *((uint32_t *)h));

  return 0;
}
-------

The result should clearly be ffffffff. Without optimisations:
$ /usr/bin/gcc-4.3  -Wall  /tmp/test.c -o /tmp/test -fschedule-insns; /tmp/test
ffffffff

With -fschedule-insns -fstrict-aliasing:
$ /usr/bin/gcc-4.3  -Wall  /tmp/test.c -o /tmp/test -fschedule-insns -fstrict-aliasing
$ /tmp/test
0

This error causes the gstreamer testsuite to break on powerpc.

  Sjoerd
-- System Information:
Debian Release: lenny/sid
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.25-2-powerpc
Locale: LANG=C, LC_CTYPE=nl_NL (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages gcc-4.3 depends on:
ii  binutils            2.18.1~cvs20080103-7 The GNU assembler, linker and bina
ii  cpp-4.3             4.3.1-2              The GNU C preprocessor
ii  gcc-4.3-base        4.3.1-2              The GNU Compiler Collection (base 
ii  libc6               2.7-12               GNU C Library: Shared libraries
ii  libgcc1             1:4.3.1-2            GCC support library
ii  libgomp1            4.3.1-2              GCC OpenMP (GOMP) support library

Versions of packages gcc-4.3 recommends:
ii  libc6-dev                     2.7-12     GNU C Library: Development Librari

-- no debconf information



--- End Message ---
--- Begin Message ---
On Sun, Jun 29, 2008 at 08:19:05PM +0100, Sjoerd Simons wrote:
>   *((uint64_t *) h) = (uint64_t) 0;
>   *((uint32_t *) h) = (uint32_t) 0xffffffff;

Violation of aliasing rules. h points either to a uint32_t oder uint64_t
not both.

> With -fschedule-insns -fstrict-aliasing:
> $ /usr/bin/gcc-4.3  -Wall  /tmp/test.c -o /tmp/test -fschedule-insns -fstrict-aliasing
> $ /tmp/test
> 0

-fstrict-aliasing enables standard conforming aliasing handling.

> This error causes the gstreamer testsuite to break on powerpc.

You break the rules, gcc breaks your output. No bug.

Bastian

-- 
Yes, it is written.  Good shall always destroy evil.
		-- Sirah the Yang, "The Omega Glory", stardate unknown


--- End Message ---

Reply to: