--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: gcc-4.0: Gcc miscompiles libc on hppa - breaks rounding
- From: "Wesley W. Terpstra" <terpstra@debian.org>
- Date: Fri, 09 Sep 2005 12:16:48 +0000
- Message-id: <E1EDhoH-0003Qb-00@paer.debian.org>
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
--- End Message ---
--- Begin Message ---
Carlos O'Donell a écrit :
On Wed, Mar 01, 2006 at 04:19:23PM +0100, Aurelien Jarno wrote:
On Wed, Mar 01, 2006 at 09:58:44AM -0500, Daniel Jacobowitz wrote:
On Wed, Mar 01, 2006 at 03:25:00PM +0100, Aurelien Jarno wrote:
Could we consider this bug as fixed, or is it only a postive side effect
of the patch fo bug#333766? I don't speak hppa assembly, so I can't
tell. Daniel, as you written the patch, could you please comment?
I didn't - I'm pretty sure it was Carlos's.
Ok sorry, as you introduced the patch to the Debian package, I thought
you also have written it.
Carlos, could you please comment it? Thanks.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=327351 for the
problem and the patch (which you probably have written).
The patch for fesetround looks good to me.
Thanks for your answer! I will close the Debian bug report then.
Bye,
Aurelien
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian GNU/Linux developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
--- End Message ---