* [BUG] gcc HEAD 2004-10-08, linux-x-sh-elf, SEGV when building newlib/libm/math/e_scalb.c
@ 2004-10-08 16:28 Corinna Vinschen
2004-10-18 12:29 ` Ben Elliston
0 siblings, 1 reply; 2+ messages in thread
From: Corinna Vinschen @ 2004-10-08 16:28 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
[Please CC me, I'm not subscribed to the list]
Hi,
I encountered the following SEGV when trying to build newlib for sh-elf
using gcc from HEAD, both (gcc and newlib) checked out this morning:
newlib/libm/math/e_scalb.c: In function '__ieee754_scalb':
newlib/libm/math/e_scalb.c:53: internal compiler error: Segmentation fault
This happens in all m2a and m4 multilibs. I've attached the precompiled
source code. The SEGV does not occur when building without optimization
or with -O, it only happens with -O2.
Running `cc1 -g -O2 -fno-builtin -m2a e_scalb.i' under GDB reports:
Starting program: [...]/libexec/gcc/sh-elf/4.0.0/cc1 -g -O2 -fno-builtin -m2a e_scalb.i
__ieee754_scalb
Analyzing compilation unit
Performing intraprocedural optimizations
Assembling functions:
__ieee754_scalb
Program received signal SIGSEGV, Segmentation fault.
optimize_mode_switching (file=0x0) at [...]/gcc/gcc/lcm.c:1035
1035 if (eg->flags & EDGE_FALLTHRU)
(
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.
[-- Attachment #2: e_scalb.i --]
[-- Type: text/plain, Size: 17695 bytes --]
# 1 "/home/corinna/src/newlib/newlib/libm/math/e_scalb.c"
# 1 "/ext/build/cross-sh-elf/newlib/sh-elf/m2a/newlib/libm/math//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/home/corinna/src/newlib/newlib/libm/math/e_scalb.c"
# 20 "/home/corinna/src/newlib/newlib/libm/math/e_scalb.c"
# 1 "/home/corinna/src/newlib/newlib/libm/math/../common/fdlibm.h" 1
# 15 "/home/corinna/src/newlib/newlib/libm/math/../common/fdlibm.h"
# 1 "/home/corinna/src/newlib/newlib/libc/include/math.h" 1 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 1 3 4
# 13 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/_ansi.h" 1 3 4
# 15 "/home/corinna/src/newlib/newlib/libc/include/_ansi.h" 3 4
# 1 "/ext/build/cross-sh-elf/newlib/sh-elf/m2a/newlib/targ-include/newlib.h" 1 3 4
# 16 "/home/corinna/src/newlib/newlib/libc/include/_ansi.h" 2 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/sys/config.h" 1 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/machine/ieeefp.h" 1 3 4
# 5 "/home/corinna/src/newlib/newlib/libc/include/sys/config.h" 2 3 4
# 17 "/home/corinna/src/newlib/newlib/libc/include/_ansi.h" 2 3 4
# 14 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 2 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/sys/_types.h" 1 3 4
# 12 "/home/corinna/src/newlib/newlib/libc/include/sys/_types.h" 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/sys/lock.h" 1 3 4
typedef int _LOCK_T;
typedef int _LOCK_RECURSIVE_T;
# 13 "/home/corinna/src/newlib/newlib/libc/include/sys/_types.h" 2 3 4
typedef long _off_t;
__extension__ typedef long long _off64_t;
typedef int _ssize_t;
# 1 "/opt/redhat/cross-sh-elf/bin/../lib/gcc/sh-elf/4.0.0/include/stddef.h" 1 3 4
# 355 "/opt/redhat/cross-sh-elf/bin/../lib/gcc/sh-elf/4.0.0/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 25 "/home/corinna/src/newlib/newlib/libc/include/sys/_types.h" 2 3 4
typedef struct
{
int __count;
union
{
wint_t __wch;
unsigned char __wchb[4];
} __value;
} _mbstate_t;
typedef _LOCK_RECURSIVE_T _flock_t;
typedef void *_iconv_t;
# 15 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 2 3 4
typedef unsigned long __ULong;
# 40 "/home/corinna/src/newlib/newlib/libc/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;
};
struct _on_exit_args {
void * _fnargs[32];
void * _dso_handle[32];
__ULong _fntypes;
__ULong _is_cxa;
};
# 85 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 3 4
struct _atexit {
struct _atexit *_next;
int _ind;
void (*_fns[32])(void);
struct _on_exit_args _on_exit_args;
};
# 101 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 3 4
struct __sbuf {
unsigned char *_base;
int _size;
};
typedef long _fpos_t;
# 166 "/home/corinna/src/newlib/newlib/libc/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;
};
# 259 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 3 4
typedef struct __sFILE __FILE;
struct _glue
{
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
# 290 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 3 4
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
# 565 "/home/corinna/src/newlib/newlib/libc/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];
};
# 799 "/home/corinna/src/newlib/newlib/libc/include/sys/reent.h" 3 4
extern struct _reent *_impure_ptr ;
extern struct _reent *const _global_impure_ptr ;
void _reclaim_reent (struct _reent *);
# 7 "/home/corinna/src/newlib/newlib/libc/include/math.h" 2 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/_ansi.h" 1 3 4
# 9 "/home/corinna/src/newlib/newlib/libc/include/math.h" 2 3 4
union __dmath
{
__ULong i[2];
double d;
};
extern const union __dmath __infinity[];
# 35 "/home/corinna/src/newlib/newlib/libc/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 "/home/corinna/src/newlib/newlib/libc/include/math.h" 3 4
typedef float float_t;
typedef double double_t;
# 82 "/home/corinna/src/newlib/newlib/libc/include/math.h" 3 4
extern int __fpclassifyf (float x);
extern int __fpclassifyd (double x);
extern int __signbitf (float x);
extern int __signbitd (double x);
# 123 "/home/corinna/src/newlib/newlib/libc/include/math.h" 3 4
extern double infinity (void);
extern double nan (const char *);
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);
# 191 "/home/corinna/src/newlib/newlib/libc/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);
# 223 "/home/corinna/src/newlib/newlib/libc/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 (const char *);
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);
# 292 "/home/corinna/src/newlib/newlib/libc/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);
# 347 "/home/corinna/src/newlib/newlib/libc/include/math.h" 3 4
enum __fdlibm_version
{
__fdlibm_ieee = -1,
__fdlibm_svid,
__fdlibm_xopen,
__fdlibm_posix
};
extern const enum __fdlibm_version __fdlib_version;
# 367 "/home/corinna/src/newlib/newlib/libc/include/math.h" 3 4
# 16 "/home/corinna/src/newlib/newlib/libm/math/../common/fdlibm.h" 2
# 1 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 1 3 4
# 24 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 3 4
typedef short int __int16_t;
typedef unsigned short int __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
__extension__ typedef long long __int64_t;
__extension__ typedef unsigned long long __uint64_t;
# 55 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 3 4
# 1 "/opt/redhat/cross-sh-elf/bin/../lib/gcc/sh-elf/4.0.0/include/stddef.h" 1 3 4
# 152 "/opt/redhat/cross-sh-elf/bin/../lib/gcc/sh-elf/4.0.0/include/stddef.h" 3 4
typedef int ptrdiff_t;
# 214 "/opt/redhat/cross-sh-elf/bin/../lib/gcc/sh-elf/4.0.0/include/stddef.h" 3 4
typedef unsigned int size_t;
# 326 "/opt/redhat/cross-sh-elf/bin/../lib/gcc/sh-elf/4.0.0/include/stddef.h" 3 4
typedef long int wchar_t;
# 56 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 2 3 4
# 1 "/home/corinna/src/newlib/newlib/libc/include/machine/types.h" 1 3 4
# 36 "/home/corinna/src/newlib/newlib/libc/include/machine/types.h" 3 4
typedef long int __off_t;
typedef int __pid_t;
__extension__ typedef long long int __loff_t;
# 57 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 2 3 4
# 78 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 3 4
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long clock_t;
typedef long time_t;
struct timespec {
time_t tv_sec;
long tv_nsec;
};
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
typedef long daddr_t;
typedef char * caddr_t;
# 121 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 3 4
typedef unsigned short ino_t;
# 155 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 3 4
typedef short dev_t;
typedef long off_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef int pid_t;
typedef long key_t;
typedef _ssize_t ssize_t;
# 184 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 3 4
typedef unsigned int mode_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned short nlink_t;
# 211 "/home/corinna/src/newlib/newlib/libc/include/sys/types.h" 3 4
typedef long fd_mask;
typedef struct _types_fd_set {
fd_mask fds_bits[(((64)+(((sizeof (fd_mask) * 8))-1))/((sizeof (fd_mask) * 8)))];
} _types_fd_set;
# 17 "/home/corinna/src/newlib/newlib/libm/math/../common/fdlibm.h" 2
# 142 "/home/corinna/src/newlib/newlib/libm/math/../common/fdlibm.h"
extern double logb (double);
extern double scalb (double, double);
extern double significand (double);
extern double __ieee754_sqrt (double);
extern double __ieee754_acos (double);
extern double __ieee754_acosh (double);
extern double __ieee754_log (double);
extern double __ieee754_atanh (double);
extern double __ieee754_asin (double);
extern double __ieee754_atan2 (double,double);
extern double __ieee754_exp (double);
extern double __ieee754_cosh (double);
extern double __ieee754_fmod (double,double);
extern double __ieee754_pow (double,double);
extern double __ieee754_lgamma_r (double,int *);
extern double __ieee754_gamma_r (double,int *);
extern double __ieee754_log10 (double);
extern double __ieee754_sinh (double);
extern double __ieee754_hypot (double,double);
extern double __ieee754_j0 (double);
extern double __ieee754_j1 (double);
extern double __ieee754_y0 (double);
extern double __ieee754_y1 (double);
extern double __ieee754_jn (int,double);
extern double __ieee754_yn (int,double);
extern double __ieee754_remainder (double,double);
extern __int32_t __ieee754_rem_pio2 (double,double*);
extern double __ieee754_scalb (double,double);
extern double __kernel_standard (double,double,int);
extern double __kernel_sin (double,double,int);
extern double __kernel_cos (double,double);
extern double __kernel_tan (double,double,int);
extern int __kernel_rem_pio2 (double*,double*,int,int,int,const __int32_t*);
extern float logbf (float);
extern float scalbf (float, float);
extern float significandf (float);
extern float __ieee754_sqrtf (float);
extern float __ieee754_acosf (float);
extern float __ieee754_acoshf (float);
extern float __ieee754_logf (float);
extern float __ieee754_atanhf (float);
extern float __ieee754_asinf (float);
extern float __ieee754_atan2f (float,float);
extern float __ieee754_expf (float);
extern float __ieee754_coshf (float);
extern float __ieee754_fmodf (float,float);
extern float __ieee754_powf (float,float);
extern float __ieee754_lgammaf_r (float,int *);
extern float __ieee754_gammaf_r (float,int *);
extern float __ieee754_log10f (float);
extern float __ieee754_sinhf (float);
extern float __ieee754_hypotf (float,float);
extern float __ieee754_j0f (float);
extern float __ieee754_j1f (float);
extern float __ieee754_y0f (float);
extern float __ieee754_y1f (float);
extern float __ieee754_jnf (int,float);
extern float __ieee754_ynf (int,float);
extern float __ieee754_remainderf (float,float);
extern __int32_t __ieee754_rem_pio2f (float,float*);
extern float __ieee754_scalbf (float,float);
extern float __kernel_sinf (float,float,int);
extern float __kernel_cosf (float,float);
extern float __kernel_tanf (float,float,int);
extern int __kernel_rem_pio2f (float*,float*,int,int,int,const __int32_t*);
# 256 "/home/corinna/src/newlib/newlib/libm/math/../common/fdlibm.h"
typedef union
{
double value;
struct
{
__uint32_t msw;
__uint32_t lsw;
} parts;
} ieee_double_shape_type;
# 343 "/home/corinna/src/newlib/newlib/libm/math/../common/fdlibm.h"
typedef union
{
float value;
__uint32_t word;
} ieee_float_shape_type;
# 21 "/home/corinna/src/newlib/newlib/libm/math/e_scalb.c" 2
# 33 "/home/corinna/src/newlib/newlib/libm/math/e_scalb.c"
double __ieee754_scalb(double x, double fn)
{
if (isnan(x)||isnan(fn)) return x*fn;
if (!finite(fn)) {
if(fn>0.0) return x*fn;
else return x/(-fn);
}
if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
if ( fn > 65000.0) return scalbn(x, 65000);
if (-fn > 65000.0) return scalbn(x,-65000);
return scalbn(x,(int)fn);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] gcc HEAD 2004-10-08, linux-x-sh-elf, SEGV when building newlib/libm/math/e_scalb.c
2004-10-08 16:28 [BUG] gcc HEAD 2004-10-08, linux-x-sh-elf, SEGV when building newlib/libm/math/e_scalb.c Corinna Vinschen
@ 2004-10-18 12:29 ` Ben Elliston
0 siblings, 0 replies; 2+ messages in thread
From: Ben Elliston @ 2004-10-18 12:29 UTC (permalink / raw)
To: gcc
Hi Corinna,
> I encountered the following SEGV when trying to build newlib for sh-elf
> using gcc from HEAD, both (gcc and newlib) checked out this morning:
>
> newlib/libm/math/e_scalb.c: In function '__ieee754_scalb':
> newlib/libm/math/e_scalb.c:53: internal compiler error: Segmentation fault
I think this is the same problem that Joern ran into. Please try
again using HEAD, as I've committed a patch which should correct it.
Cheers, Ben
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-18 8:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-08 16:28 [BUG] gcc HEAD 2004-10-08, linux-x-sh-elf, SEGV when building newlib/libm/math/e_scalb.c Corinna Vinschen
2004-10-18 12:29 ` Ben Elliston
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).