public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/46993] New: Optimization on i386 lead to user-visible traps during floating-point operations
@ 2010-12-17 16:34 arseny.klimovsky at gmail dot com
  2011-01-12 12:05 ` [Bug target/46993] " arseny.klimovsky at gmail dot com
  2024-03-12 22:12 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: arseny.klimovsky at gmail dot com @ 2010-12-17 16:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46993

           Summary: Optimization on i386 lead to user-visible traps during
                    floating-point operations
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arseny.klimovsky@gmail.com


Version:
$ g++-4.5.2 -v
Using built-in specs.
COLLECT_GCC=g++-4.5.2
COLLECT_LTO_WRAPPER=/opt/gcc-4.5.2/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.5.2/configure --prefix /opt/gcc-4.5.2/
Thread model: posix
gcc version 4.5.2 (GCC)

Command:
$ g++ -m32 -fsignaling-nans -O1 -c -S -o simple.s simple.cpp 

Consider a simple function, which copies one value from double array c to
double array a.

#include <string.h>
void copy (double * a, double * c)
{
  double b[100];
  memcpy (b, c, sizeof (double));
  memcpy (a, b, sizeof (double));
}

This will generate code
        .cfi_startproc
        pushl   %ebp
        .cfi_def_cfa_offset 8
        movl    %esp, %ebp
        .cfi_offset 5, -8
        .cfi_def_cfa_register 5
        movl    12(%ebp), %eax
        fldl    (%eax)
        movl    8(%ebp), %eax
        fstpl   (%eax)
        popl    %ebp
        .cfi_restore 5
        .cfi_def_cfa 4, 4
        ret
        .cfi_endproc

Here, if c[0] is a NaN, and FPU exception mask is set, an FPE will occur.
In gcc 4.4 and earlier I could use memcpy instead of operator= to be sure, that
no floating point operations will be generated.
Now I don't know how to safely copy values from local double buffer (or a
single variable) to some address without floating point operations.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/46993] Optimization on i386 lead to user-visible traps during floating-point operations
  2010-12-17 16:34 [Bug target/46993] New: Optimization on i386 lead to user-visible traps during floating-point operations arseny.klimovsky at gmail dot com
@ 2011-01-12 12:05 ` arseny.klimovsky at gmail dot com
  2024-03-12 22:12 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: arseny.klimovsky at gmail dot com @ 2011-01-12 12:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46993

--- Comment #1 from Arseny Klimovsky <arseny.klimovsky at gmail dot com> 2011-01-12 11:59:13 UTC ---
This bug is quite similar to another one in Debian BTS
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561611


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/46993] Optimization on i386 lead to user-visible traps during floating-point operations
  2010-12-17 16:34 [Bug target/46993] New: Optimization on i386 lead to user-visible traps during floating-point operations arseny.klimovsky at gmail dot com
  2011-01-12 12:05 ` [Bug target/46993] " arseny.klimovsky at gmail dot com
@ 2024-03-12 22:12 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-12 22:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46993

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=42834
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |4.6.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 4.6.0; most likely by r0-101269-g70f348148c0946 (and maybe
another).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-12 22:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-17 16:34 [Bug target/46993] New: Optimization on i386 lead to user-visible traps during floating-point operations arseny.klimovsky at gmail dot com
2011-01-12 12:05 ` [Bug target/46993] " arseny.klimovsky at gmail dot com
2024-03-12 22:12 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).