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

Bug#327351: gcc-4.0: Gcc miscompiles libc on hppa - breaks rounding



Package: gcc-4.0
Version: 4.0.1-6
Severity: important

When compiling the fesetround function (which controls the processor
rounding mode), gcc-4.0 incorrectly optimizes away the code!!!

Here's the C code in question:
  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
  sw[0] &= ~FE_DOWNWARD;
  sw[0] |= round;
  __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));

gcc-3.3 outputs:
#APP
        fstd %fr0,0(%r20)
#NO_APP
	ldw -56(%r30),%r19
	depi 0,22,2,%r19
	or %r19,%r26,%r19
	stw %r19,-56(%r30)
#APP
	fldd 0(%r20),%fr0
#NO_APP

gcc-4.0 outputs:
#APP
        fstd %fr0,0(%r28)
	fldd 0(%r28),%fr0
#NO_APP

Due to this bug, the rounding mode is broken for all clients of
libc on hppa. It's hard to judge how many applications are affected
since the failure is silent and simply results in incorrect
calculations. This may lead to any number of bugs...
		
-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: hppa (parisc64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-64-smp
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages gcc-4.0 depends on:
ii  binutils                      2.16.1-2   The GNU assembler, linker and bina
ii  cpp-4.0                       4.0.1-6    The GNU C preprocessor
ii  gcc-4.0-base                  4.0.1-6    The GNU Compiler Collection (base 
ii  libc6                         2.3.5-6    GNU C Library: Shared libraries an
ii  libgcc2                       4.0.1-6    GCC support library

Versions of packages gcc-4.0 recommends:
ii  libc6-dev                     2.3.5-6    GNU C Library: Development Librari
pn  libmudflap0-dev               <none>     (no description available)

-- no debconf information



Reply to: