This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/13595] New: '-march=athlon-xp' option changes program behavior


The program file given below was compiled and run on an AMD AthlonXP

compiling with 'gcc file.c'
and running the program generates a SIGFPE exception

compiling with 'gcc -march=athlon-xp file.c'
and the SIGFPE exception is no longer generated

/* start of program file */
#include <stdio.h>
#include <signal.h>
#include <fpu_control.h>

void 
sigfpe_handler (int signum)
{
  printf("SIGFPE caught, exiting program.\n");
  exit(1);
}

int 
main()
{
  fpu_control_t mask = _FPU_DEFAULT & ~_FPU_MASK_PM;  
  float f = 0.54030277F;

  /* let the FPU generate an interrupt on a Precision (inexact result) error */
  _FPU_SETCW(mask);
  (void) signal (SIGFPE, sigfpe_handler);

  printf("%.10f cast to int = %i\n", f, (int) f);

  return 0;
}
/* end of program file */

-- 
           Summary: '-march=athlon-xp' option changes program behavior
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stevech1097 at yahoo dot com dot au
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]