public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/9835: ICE - segfault using -msoft-float with latest mips-elf toolchain
@ 2003-02-24 17:06 fnf
  0 siblings, 0 replies; 2+ messages in thread
From: fnf @ 2003-02-24 17:06 UTC (permalink / raw)
  To: gcc-gnats; +Cc: fnf


>Number:         9835
>Category:       c
>Synopsis:       Internal Compiler Error (segfault) with -msoft-float for mips-elf toolchain
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 17:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Fred Fish
>Release:        3.4 20030224 (experimental)
>Organization:
Intrinsity Inc
>Environment:
System: Linux fred.ninemoons.com 2.4.18-24.8.0 #1 Fri Jan 31 06:51:30 EST 2003 i686 i686 i386 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: mips-unknown-elf
configured with: /src/sourceware/gcc/gcc/configure -v --prefix=/usr/local/sourceware --target=mips-elf --enable-gdbtk --disable-multilib --with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c,c++ : (reconfigured) 
>Description:

	Internal compiler error in mips-elf toolchain using -msoft-float.

>How-To-Repeat:

	$ ./cc1 -quiet -O2 floatformat.i
	$ ./cc1 -quiet -O2 -msoft-float floatformat.i
	/tmp/fnf/src/gcc/libiberty/floatformat.c: In function `floatformat_from_double':
	/tmp/fnf/src/gcc/libiberty/floatformat.c:404: internal compiler error: Segmentation fault

-------------- begin floatformat.i -------------
# 1 "/tmp/fnf/src/gcc/libiberty/floatformat.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/tmp/fnf/src/gcc/libiberty/floatformat.c"
# 20 "/tmp/fnf/src/gcc/libiberty/floatformat.c"
# 1 "/tmp/fnf/src/gcc/include/floatformat.h" 1
# 23 "/tmp/fnf/src/gcc/include/floatformat.h"
# 1 "/tmp/fnf/src/gcc/include/ansidecl.h" 1
# 24 "/tmp/fnf/src/gcc/include/floatformat.h" 2
# 33 "/tmp/fnf/src/gcc/include/floatformat.h"
enum floatformat_byteorders {




  floatformat_little,




  floatformat_big,




  floatformat_littlebyte_bigword

};

enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no };

struct floatformat
{
  enum floatformat_byteorders byteorder;
  unsigned int totalsize;


  unsigned int sign_start;

  unsigned int exp_start;
  unsigned int exp_len;

  unsigned int exp_bias;



  unsigned int exp_nan;

  unsigned int man_start;
  unsigned int man_len;


  enum floatformat_intbit intbit;


  const char *name;
};



extern const struct floatformat floatformat_ieee_single_big;
extern const struct floatformat floatformat_ieee_single_little;
extern const struct floatformat floatformat_ieee_double_big;
extern const struct floatformat floatformat_ieee_double_little;



extern const struct floatformat floatformat_ieee_double_littlebyte_bigword;



extern const struct floatformat floatformat_i387_ext;
extern const struct floatformat floatformat_m68881_ext;
extern const struct floatformat floatformat_i960_ext;
extern const struct floatformat floatformat_m88110_ext;
extern const struct floatformat floatformat_m88110_harris_ext;
extern const struct floatformat floatformat_arm_ext_big;
extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;

extern const struct floatformat floatformat_ia64_spill_big;
extern const struct floatformat floatformat_ia64_spill_little;
extern const struct floatformat floatformat_ia64_quad_big;
extern const struct floatformat floatformat_ia64_quad_little;





extern void
floatformat_to_double (const struct floatformat *, char *, double *);




extern void
floatformat_from_double (const struct floatformat *, double *, char *);
# 21 "/tmp/fnf/src/gcc/libiberty/floatformat.c" 2
# 1 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 1 3 4





# 1 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 1 3 4
# 13 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
# 1 "/local/intrinsity/mipsisa32-intrinsity-elf/include/_ansi.h" 1 3 4
# 15 "/local/intrinsity/mipsisa32-intrinsity-elf/include/_ansi.h" 3 4
# 1 "/local/intrinsity/mipsisa32-intrinsity-elf/include/newlib.h" 1 3 4
# 16 "/local/intrinsity/mipsisa32-intrinsity-elf/include/_ansi.h" 2 3 4
# 1 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/config.h" 1 3 4



# 1 "/local/intrinsity/mipsisa32-intrinsity-elf/include/machine/ieeefp.h" 1 3 4
# 5 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/config.h" 2 3 4
# 17 "/local/intrinsity/mipsisa32-intrinsity-elf/include/_ansi.h" 2 3 4
# 14 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 2 3 4
# 1 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/_types.h" 1 3 4
# 12 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/_types.h" 3 4
typedef long _off_t;
__extension__ typedef long long _off64_t;


typedef int _ssize_t;





# 1 "/usr/local/tmp/fnf/build/gcc/gcc/include/stddef.h" 1 3 4
# 354 "/usr/local/tmp/fnf/build/gcc/gcc/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 23 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/_types.h" 2 3 4


typedef struct
{
  int __count;
  union
  {
    wint_t __wch;
    unsigned char __wchb[4];
  } __value;
} _mbstate_t;

typedef int _flock_t;
# 15 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 2 3 4




typedef unsigned long __ULong;
# 40 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
struct _Bigint
{
  struct _Bigint *_next;
  int _k, _maxwds, _sign, _wds;
  __ULong _x[1];
};


struct __tm
{
  int __tm_sec;
  int __tm_min;
  int __tm_hour;
  int __tm_mday;
  int __tm_mon;
  int __tm_year;
  int __tm_wday;
  int __tm_yday;
  int __tm_isdst;
};
# 68 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
struct _atexit {
        struct _atexit *_next;
        int _ind;
        void (*_fns[32])(void);
        void *_fnargs[32];
        __ULong _fntypes;
};
# 91 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
struct __sbuf {
        unsigned char *_base;
        int _size;
};






typedef long _fpos_t;
# 156 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
struct __sFILE {
  unsigned char *_p;
  int _r;
  int _w;
  short _flags;
  short _file;
  struct __sbuf _bf;
  int _lbfsize;






  void * _cookie;

  int (*_read) (void * _cookie, char *_buf, int _n);
  int (*_write) (void * _cookie, const char *_buf, int _n);

  _fpos_t (*_seek) (void * _cookie, _fpos_t _offset, int _whence);
  int (*_close) (void * _cookie);


  struct __sbuf _ub;
  unsigned char *_up;
  int _ur;


  unsigned char _ubuf[3];
  unsigned char _nbuf[1];


  struct __sbuf _lb;


  int _blksize;
  int _offset;


  struct _reent *_data;



  _flock_t _lock;

};
# 249 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
typedef struct __sFILE __FILE;


struct _glue
{
  struct _glue *_next;
  int _niobs;
  __FILE *_iobs;
};
# 280 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
struct _rand48 {
  unsigned short _seed[3];
  unsigned short _mult[3];
  unsigned short _add;




};
# 532 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
struct _reent
{
  int _errno;




  __FILE *_stdin, *_stdout, *_stderr;

  int _inc;
  char _emergency[25];

  int _current_category;
  const char *_current_locale;

  int __sdidinit;

  void (*__cleanup) (struct _reent *);


  struct _Bigint *_result;
  int _result_k;
  struct _Bigint *_p5s;
  struct _Bigint **_freelist;


  int _cvtlen;
  char *_cvtbuf;

  union
    {
      struct
        {
          unsigned int _unused_rand;
          char * _strtok_last;
          char _asctime_buf[26];
          struct __tm _localtime_buf;
          int _gamma_signgam;
          __extension__ unsigned long long _rand_next;
          struct _rand48 _r48;
          _mbstate_t _mblen_state;
          _mbstate_t _mbtowc_state;
          _mbstate_t _wctomb_state;
          char _l64a_buf[8];
          char _signal_buf[24];
          int _getdate_err;
          _mbstate_t _mbrlen_state;
          _mbstate_t _mbrtowc_state;
          _mbstate_t _mbsrtowcs_state;
          _mbstate_t _wcrtomb_state;
          _mbstate_t _wcsrtombs_state;
        } _reent;



      struct
        {

          unsigned char * _nextf[30];
          unsigned int _nmalloc[30];
        } _unused;
    } _new;


  struct _atexit *_atexit;
  struct _atexit _atexit0;


  void (**(_sig_func))(int);




  struct _glue __sglue;
  __FILE __sf[3];
};
# 728 "/local/intrinsity/mipsisa32-intrinsity-elf/include/sys/reent.h" 3 4
extern struct _reent *_impure_ptr ;

void _reclaim_reent (struct _reent *);
# 7 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 2 3 4










union __dmath
{
  __ULong i[2];
  double d;
};




extern const union __dmath __infinity[];
# 35 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
extern double atan (double);
extern double cos (double);
extern double sin (double);
extern double tan (double);
extern double tanh (double);
extern double frexp (double, int *);
extern double modf (double, double *);
extern double ceil (double);
extern double fabs (double);
extern double floor (double);






extern double acos (double);
extern double asin (double);
extern double atan2 (double, double);
extern double cosh (double);
extern double sinh (double);
extern double exp (double);
extern double ldexp (double, int);
extern double log (double);
extern double log10 (double);
extern double pow (double, double);
extern double sqrt (double);
extern double fmod (double, double);
# 72 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
typedef float float_t;
typedef double double_t;
# 82 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
extern int __fpclassifyf (float x);
extern int __fpclassifyd (double x);
# 121 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
extern double infinity (void);
extern double nan (void);
extern int isnan (double);
extern int isinf (double);
extern int finite (double);
extern double copysign (double, double);
extern int ilogb (double);

extern double asinh (double);
extern double cbrt (double);
extern double nextafter (double, double);
extern double rint (double);
extern double scalbn (double, int);

extern double exp2 (double);
extern double scalbln (double, long int);
extern double tgamma (double);
extern double nearbyint (double);
extern long int lrint (double);
extern double round (double);
extern long int lround (double);
extern double trunc (double);
extern double remquo (double, double, int *);
extern double copysign (double, double);
extern double fdim (double, double);
extern double fmax (double, double);
extern double fmin (double, double);
extern double fma (double, double, double);
extern void sincos (double, double *, double *);


extern double log1p (double);
extern double expm1 (double);



extern double acosh (double);
extern double atanh (double);
extern double remainder (double, double);
extern double gamma (double);
extern double gamma_r (double, int *);
extern double lgamma (double);
extern double lgamma_r (double, int *);
extern double erf (double);
extern double erfc (double);
extern double y0 (double);
extern double y1 (double);
extern double yn (int, double);
extern double j0 (double);
extern double j1 (double);
extern double jn (int, double);



extern double hypot (double, double);


extern double cabs();
extern double drem (double, double);
# 189 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
extern float atanf (float);
extern float cosf (float);
extern float sinf (float);
extern float tanf (float);
extern float tanhf (float);
extern float frexpf (float, int *);
extern float modff (float, float *);
extern float ceilf (float);
extern float fabsf (float);
extern float floorf (float);


extern float acosf (float);
extern float asinf (float);
extern float atan2f (float, float);
extern float coshf (float);
extern float sinhf (float);
extern float expf (float);
extern float ldexpf (float, int);
extern float logf (float);
extern float log10f (float);
extern float powf (float, float);
extern float sqrtf (float);
extern float fmodf (float, float);
# 221 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
extern float exp2f (float);
extern float scalblnf (float, long int);
extern float tgammaf (float);
extern float nearbyintf (float);
extern long int lrintf (float);
extern float roundf (float);
extern long int lroundf (float);
extern float truncf (float);
extern float remquof (float, float, int *);
extern float copysignf (float, float);
extern float fdimf (float, float);
extern float fmaxf (float, float);
extern float fminf (float, float);
extern float fmaf (float, float, float);

extern float infinityf (void);
extern float nanf (void);
extern int isnanf (float);
extern int isinff (float);
extern int finitef (float);
extern float copysignf (float, float);
extern int ilogbf (float);

extern float asinhf (float);
extern float cbrtf (float);
extern float nextafterf (float, float);
extern float rintf (float);
extern float scalbnf (float, int);
extern float log1pf (float);
extern float expm1f (float);
extern void sincosf (float, float *, float *);


extern float acoshf (float);
extern float atanhf (float);
extern float remainderf (float, float);
extern float gammaf (float);
extern float gammaf_r (float, int *);
extern float lgammaf (float);
extern float lgammaf_r (float, int *);
extern float erff (float);
extern float erfcf (float);
extern float y0f (float);
extern float y1f (float);
extern float ynf (int, float);
extern float j0f (float);
extern float j1f (float);
extern float jnf (int, float);

extern float hypotf (float, float);

extern float cabsf();
extern float dremf (float, float);






extern int *__signgam (void);
# 290 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
struct exception

{
  int type;
  char *name;
  double arg1;
  double arg2;
  double retval;
  int err;
};




extern int matherr (struct exception *e);
# 345 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4
enum __fdlibm_version
{
  __fdlibm_ieee = -1,
  __fdlibm_svid,
  __fdlibm_xopen,
  __fdlibm_posix
};




extern const enum __fdlibm_version __fdlib_version;
# 365 "/local/intrinsity/mipsisa32-intrinsity-elf/include/math.h" 3 4

# 22 "/tmp/fnf/src/gcc/libiberty/floatformat.c" 2

# 1 "/usr/local/tmp/fnf/build/gcc/gcc/include/stddef.h" 1 3 4
# 151 "/usr/local/tmp/fnf/build/gcc/gcc/include/stddef.h" 3 4
typedef int ptrdiff_t;
# 213 "/usr/local/tmp/fnf/build/gcc/gcc/include/stddef.h" 3 4
typedef unsigned int size_t;
# 325 "/usr/local/tmp/fnf/build/gcc/gcc/include/stddef.h" 3 4
typedef int wchar_t;
# 24 "/tmp/fnf/src/gcc/libiberty/floatformat.c" 2
extern void *memcpy (void *s1, const void *s2, size_t n);
extern void *memset (void *s, int c, size_t n);
# 37 "/tmp/fnf/src/gcc/libiberty/floatformat.c"
const struct floatformat floatformat_ieee_single_big =
{
  floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23,
  floatformat_intbit_no,
  "floatformat_ieee_single_big"
};
const struct floatformat floatformat_ieee_single_little =
{
  floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23,
  floatformat_intbit_no,
  "floatformat_ieee_single_little"
};
const struct floatformat floatformat_ieee_double_big =
{
  floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52,
  floatformat_intbit_no,
  "floatformat_ieee_double_big"
};
const struct floatformat floatformat_ieee_double_little =
{
  floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52,
  floatformat_intbit_no,
  "floatformat_ieee_double_little"
};




const struct floatformat floatformat_ieee_double_littlebyte_bigword =
{
  floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52,
  floatformat_intbit_no,
  "floatformat_ieee_double_littlebyte_bigword"
};

const struct floatformat floatformat_i387_ext =
{
  floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
  floatformat_intbit_yes,
  "floatformat_i387_ext"
};
const struct floatformat floatformat_m68881_ext =
{

  floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64,
  floatformat_intbit_yes,
  "floatformat_m68881_ext"
};
const struct floatformat floatformat_i960_ext =
{

  floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64,
  floatformat_intbit_yes,
  "floatformat_i960_ext"
};
const struct floatformat floatformat_m88110_ext =
{
  floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
  floatformat_intbit_yes,
  "floatformat_m88110_ext"
};
const struct floatformat floatformat_m88110_harris_ext =
{


  floatformat_big,128, 0, 1, 11, 0x3ff, 0x7ff, 12, 52,
  floatformat_intbit_no,
  "floatformat_m88110_ext_harris"
};
const struct floatformat floatformat_arm_ext_big =
{

  floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
  floatformat_intbit_yes,
  "floatformat_arm_ext_big"
};
const struct floatformat floatformat_arm_ext_littlebyte_bigword =
{

  floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
  floatformat_intbit_yes,
  "floatformat_arm_ext_littlebyte_bigword"
};
const struct floatformat floatformat_ia64_spill_big =
{
  floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
  floatformat_intbit_yes,
  "floatformat_ia64_spill_big"
};
const struct floatformat floatformat_ia64_spill_little =
{
  floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
  floatformat_intbit_yes,
  "floatformat_ia64_spill_little"
};
const struct floatformat floatformat_ia64_quad_big =
{
  floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
  floatformat_intbit_no,
  "floatformat_ia64_quad_big"
};
const struct floatformat floatformat_ia64_quad_little =
{
  floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
  floatformat_intbit_no,
  "floatformat_ia64_quad_little"
};

static unsigned long get_field (unsigned char *, enum floatformat_byteorders, unsigned int, unsigned int, unsigned int);







static unsigned long
get_field (data, order, total_len, start, len)
     unsigned char *data;
     enum floatformat_byteorders order;
     unsigned int total_len;
     unsigned int start;
     unsigned int len;
{
  unsigned long result;
  unsigned int cur_byte;
  int cur_bitshift;


  cur_byte = (start + len) / 8;
  if (order == floatformat_little)
    cur_byte = (total_len / 8) - cur_byte - 1;
  cur_bitshift =
    ((start + len) % 8) - 8;
  result = *(data + cur_byte) >> (-cur_bitshift);
  cur_bitshift += 8;
  if (order == floatformat_little)
    ++cur_byte;
  else
    --cur_byte;


  while ((unsigned int) cur_bitshift < len)
    {
      if (len - cur_bitshift < 8)


        result |=
          (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1))
            << cur_bitshift;
      else
        result |= *(data + cur_byte) << cur_bitshift;
      cur_bitshift += 8;
      if (order == floatformat_little)
        ++cur_byte;
      else
        --cur_byte;
    }
  return result;
}
# 206 "/tmp/fnf/src/gcc/libiberty/floatformat.c"
void
floatformat_to_double (fmt, from, to)
     const struct floatformat *fmt;
     char *from;
     double *to;
{
  unsigned char *ufrom = (unsigned char *)from;
  double dto;
  long exponent;
  unsigned long mant;
  unsigned int mant_bits, mant_off;
  int mant_bits_left;
  int special_exponent;

  exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
                        fmt->exp_start, fmt->exp_len);




  mant_bits_left = fmt->man_len;
  mant_off = fmt->man_start;
  dto = 0.0;

  special_exponent = exponent == 0 || (unsigned long) exponent == fmt->exp_nan;


  if (!special_exponent)
    exponent -= fmt->exp_bias;







  if (!special_exponent)
    {
      if (fmt->intbit == floatformat_intbit_no)
        dto = ldexp (1.0, exponent);
      else
        exponent++;
    }

  while (mant_bits_left > 0)
    {
      mant_bits = ((mant_bits_left) < (32) ? (mant_bits_left) : (32));

      mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
                         mant_off, mant_bits);

      dto += ldexp ((double)mant, exponent - mant_bits);
      exponent -= mant_bits;
      mant_off += mant_bits;
      mant_bits_left -= mant_bits;
    }


  if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
    dto = -dto;
  *to = dto;
}

static void put_field (unsigned char *, enum floatformat_byteorders, unsigned int, unsigned int, unsigned int, unsigned long);







static void
put_field (data, order, total_len, start, len, stuff_to_put)
     unsigned char *data;
     enum floatformat_byteorders order;
     unsigned int total_len;
     unsigned int start;
     unsigned int len;
     unsigned long stuff_to_put;
{
  unsigned int cur_byte;
  int cur_bitshift;


  cur_byte = (start + len) / 8;
  if (order == floatformat_little)
    cur_byte = (total_len / 8) - cur_byte - 1;
  cur_bitshift =
    ((start + len) % 8) - 8;
  *(data + cur_byte) &=
    ~(((1 << ((start + len) % 8)) - 1) << (-cur_bitshift));
  *(data + cur_byte) |=
    (stuff_to_put & ((1 << 8) - 1)) << (-cur_bitshift);
  cur_bitshift += 8;
  if (order == floatformat_little)
    ++cur_byte;
  else
    --cur_byte;


  while ((unsigned int) cur_bitshift < len)
    {
      if (len - cur_bitshift < 8)
        {

          *(data + cur_byte) &=
            ~((1 << (len - cur_bitshift)) - 1);
          *(data + cur_byte) |= (stuff_to_put >> cur_bitshift);
        }
      else
        *(data + cur_byte) = ((stuff_to_put >> cur_bitshift)
                              & ((1 << 8) - 1));
      cur_bitshift += 8;
      if (order == floatformat_little)
        ++cur_byte;
      else
        --cur_byte;
    }
}





void
floatformat_from_double (fmt, from, to)
     const struct floatformat *fmt;
     double *from;
     char *to;
{
  double dfrom;
  int exponent;
  double mant;
  unsigned int mant_bits, mant_off;
  int mant_bits_left;
  unsigned char *uto = (unsigned char *)to;

  memcpy (&dfrom, from, sizeof (dfrom));
  memset (uto, 0, fmt->totalsize / 8);
  if (dfrom == 0)
    return;
  if (dfrom != dfrom)
    {

      put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
                 fmt->exp_len, fmt->exp_nan);

      put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start,
                 32, 1);
      return;
    }


  if (dfrom < 0)
    {
      put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1);
      dfrom = -dfrom;
    }



  mant = frexp (dfrom, &exponent);
  put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len,
             exponent + fmt->exp_bias - 1);

  mant_bits_left = fmt->man_len;
  mant_off = fmt->man_start;
  while (mant_bits_left > 0)
    {
      unsigned long mant_long;
      mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;

      mant *= 4294967296.0;
      mant_long = (unsigned long)mant;
      mant -= mant_long;





      if ((unsigned int) mant_bits_left == fmt->man_len
          && fmt->intbit == floatformat_intbit_no)
        {
          mant_long &= 0x7fffffff;
          mant_bits -= 1;
        }
      else if (mant_bits < 32)
        {


          mant_long >>= 32 - mant_bits;
        }

      put_field (uto, fmt->byteorder, fmt->totalsize,
                 mant_off, mant_bits, mant_long);
      mant_off += mant_bits;
      mant_bits_left -= mant_bits;
    }
}
-------------- end floatformat.i -------------

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c/9835: ICE - segfault using -msoft-float with latest mips-elf toolchain
@ 2003-02-25 22:26 fnf
  0 siblings, 0 replies; 2+ messages in thread
From: fnf @ 2003-02-25 22:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9835; it has been noted by GNATS.

From: <fnf@intrinsity.com>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/9835: ICE - segfault using -msoft-float with latest mips-elf toolchain
Date: Tue, 25 Feb 2003 16:21:43 -0600 (CST)

 From fnf@public.ninemoons.com  Tue Feb 25 11:32:11 2003
 Return-Path: <fnf@public.ninemoons.com>
 X-Original-To: fnf@victoria.eng.evsx.com
 Delivered-To: fnf@victoria.eng.evsx.com
 Received: from mailhost.intrinsity.com (gw.intrinsity.com [208.246.32.130])
 	by victoria.intrinsity.com (Postfix) with ESMTP id DCEED4586C
 	for <fnf@victoria.eng.evsx.com>; Tue, 25 Feb 2003 11:32:10 -0600 (CST)
 Received: by mailhost.intrinsity.com (Postfix)
 	id DDBCD3F3A8; Tue, 25 Feb 2003 11:31:52 -0600 (CST)
 Delivered-To: fnf@intrinsity.com
 Received: from fred.ninemoons.com (wsip68-14-214-217.ph.ph.cox.net [68.14.214.217])
 	by mailhost.intrinsity.com (Postfix) with ESMTP id 1F1153F3A6
 	for <fnf@intrinsity.com>; Tue, 25 Feb 2003 11:31:52 -0600 (CST)
 Received: from fred.ninemoons.com (localhost.localdomain [127.0.0.1])
 	by fred.ninemoons.com (8.12.5/8.12.5) with ESMTP id h1PHZKwI005729;
 	Tue, 25 Feb 2003 10:35:26 -0700
 Received: (from fnf@localhost)
 	by fred.ninemoons.com (8.12.5/8.12.5/Submit) id h1PHZJLl005727;
 	Tue, 25 Feb 2003 10:35:19 -0700
 From: Fred Fish <fnf@public.ninemoons.com>
 Message-Id: <200302251735.h1PHZJLl005727@fred.ninemoons.com>
 Subject: Re: c/9835: ICE - segfault using -msoft-float with latest mips-elf toolchain
 To: gcc-bugs@gcc.gnu.org
 Date: Tue, 25 Feb 2003 10:35:19 -0700 (MST)
 Cc: kazu@cs.umass.edu, fnf@intrinsity.com
 Reply-To: fnf@intrinsity.com
 X-Mailer: ELM [version 2.5 PL6]
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 The following code (simplified from my original reported testcase)
 triggers an internal compiler error when compiled with -O2 and
 -msoft-float by the latest mips-elf toolchain:
 
   void
   foo ()
   {
     double dval;
     unsigned int ival;
   
     if (dval == 0)
       return;
     if (dval != dval)
       {
         bar (ival);
       }
     if (dval < 0)
       {
         bar (ival);
       }
   }
 
 For example:
 
   $ ./cc1 -O2 -msoft-float segfault.i
    foo
   segfault.i: In function `foo':
   segfault.i:17: internal compiler error: Segmentation fault  
 
 Comparing with a previously working compiler, I have backtracked the
 problem to a recent change made to cprop_jump().  The following patch
 that reverts one line of that change will sidestep the problem, but is
 probably NOT the right fix.  Unfortunately my knowledge of gcc
 internals is not sufficient for me to provide a better patch at this
 time.
 
   Index: gcse.c
   ===================================================================
   RCS file: /mips/newtools/fsf/gcc/gcc/gcse.c,v
   retrieving revision 1.3
   diff -u -p -r1.3 gcse.c
   --- gcse.c    2003/02/24 15:40:41     1.3
   +++ gcse.c    2003/02/25 17:29:28
   @@ -4064,7 +4064,7 @@ cprop_jump (bb, setcc, jump, from, src)
    
          new_set = simplify_replace_rtx (SET_SRC (set),
                                       SET_DEST (setcc_set),
   -                                   setcc_set_src);
   +                                   SET_SRC (setcc_set));
        }
      else
        new_set = set;
 
 -Fred
 
 


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

end of thread, other threads:[~2003-02-25 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24 17:06 c/9835: ICE - segfault using -msoft-float with latest mips-elf toolchain fnf
2003-02-25 22:26 fnf

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).