[Bug regression/16144] New: Bogus reference to __divdf3 when -O1

pkoning at equallogic dot com gcc-bugzilla@gcc.gnu.org
Tue Jun 22 18:16:00 GMT 2004


Building some of the NetBSD libm (for example, e_acosh.c) with -O1 gives me a
miscompilation of some (but not all) of the DF divides.  Some produce the
expected div.d instruction, but some produce a call to __divdf3.  Since the
system config isn't set up for soft float, this causes applications not to link.

Compiling with -O2 works correctly.  V3.3.3 works correctly.

Attached is e_acosh.i, derived from the NetBSD 1.6.2 libm e_acosh.c.

# 1 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/e_acosh.c"
# 1
"/buildarea/cvs162/bin/objs.sbmips.debug/buildarea/cvs162/NetBSD162/src/lib/libm//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/e_acosh.c"
# 13 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/e_acosh.c"
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/cdefs.h" 1 3 4
# 63 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/cdefs.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/cdefs.h" 1 3 4


# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/cdefs.h" 1 3 4
# 4 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/cdefs.h" 2 3 4
# 64 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/cdefs.h" 2 3 4

# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/cdefs_elf.h" 1 3 4
# 66 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/cdefs.h" 2 3 4
# 14 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/e_acosh.c" 2

__asm__(".section " ".ident" " ; .asciz \"" "$NetBSD: e_acosh.c,v 1.11
1999/07/02 15:37:38 simonb Exp $" "\" ; .text");
# 32 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/e_acosh.c"
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 1 3 4
# 22 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/featuretest.h" 1 3 4
# 23 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 2 3 4

union __float_u {
 unsigned char __dummy[sizeof(float)];
 float __val;
};

union __double_u {
 unsigned char __dummy[sizeof(double)];
 double __val;
};

# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/math.h" 1 3 4


# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/math.h" 1 3 4
# 4 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/math.h" 2 3 4
# 35 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 2 3 4




extern const union __double_u __infinity;
# 49 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 3 4
extern const union __float_u __nanf;
# 73 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 3 4
extern int signgam;




enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
# 90 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 3 4
extern enum fdversion _fdlib_version;







struct exception {
 int type;
 char *name;
 double arg1;
 double arg2;
 double retval;
};
# 125 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 3 4




double acos (double);
double asin (double);
double atan (double);
double atan2 (double, double);
double cos (double);
double sin (double);
double tan (double);

double cosh (double);
double sinh (double);
double tanh (double);

double exp (double);
double frexp (double, int *);
double ldexp (double, int);
double log (double);
double log10 (double);
double modf (double, double *);

double pow (double, double);
double sqrt (double);

double ceil (double);
double fabs (double);
double floor (double);
double fmod (double, double);



double erf (double);
double erfc (double);
double gamma (double);
double hypot (double, double);
int isnan (double);
int finite (double);
double j0 (double);
double j1 (double);
double jn (int, double);
double lgamma (double);
double y0 (double);
double y1 (double);
double yn (int, double);


double acosh (double);
double asinh (double);
double atanh (double);
double cbrt (double);
double expm1 (double);
int ilogb (double);
double log1p (double);
double logb (double);
double nextafter (double, double);
double remainder (double, double);
double rint (double);
double scalb (double, double);






int matherr (struct exception *);





double significand (double);




double copysign (double, double);
double scalbn (double, int);





double cabs ( );

double drem (double, double);
# 221 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 3 4
double gamma_r (double, int *);
double lgamma_r (double, int *);





int isinf (double);


float acosf (float);
float asinf (float);
float atanf (float);
float atan2f (float, float);
float cosf (float);
float sinf (float);
float tanf (float);

float coshf (float);
float sinhf (float);
float tanhf (float);

float expf (float);
float frexpf (float, int *);
float ldexpf (float, int);
float logf (float);
float log10f (float);
float modff (float, float *);

float powf (float, float);
float sqrtf (float);

float ceilf (float);
float fabsf (float);
float floorf (float);
float fmodf (float, float);

float erff (float);
float erfcf (float);
float gammaf (float);
float hypotf (float, float);
int isinff (float);
int isnanf (float);
int finitef (float);
float j0f (float);
float j1f (float);
float jnf (int, float);
float lgammaf (float);
float y0f (float);
float y1f (float);
float ynf (int, float);

float acoshf (float);
float asinhf (float);
float atanhf (float);
float cbrtf (float);
float logbf (float);
float nextafterf (float, float);
float remainderf (float, float);
float scalbf (float, float);




float significandf (float);





float copysignf (float, float);
int ilogbf (float);
float rintf (float);
float scalbnf (float, int);





float cabsf ( );

float dremf (float, float);
float expm1f (float);
float log1pf (float);
# 314 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/math.h" 3 4
float gammaf_r (float, int *);
float lgammaf_r (float, int *);



# 33 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/e_acosh.c" 2
# 1 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/math_private.h" 1
# 20 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/math_private.h"
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 1 3 4
# 47 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/types.h" 1 3 4


# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/types.h" 1 3 4
# 45 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/types.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/int_types.h" 1 3 4
# 50 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/int_types.h" 3 4
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short int __int16_t;
typedef unsigned short int __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;





typedef long long int __int64_t;

typedef unsigned long long int __uint64_t;






typedef int __intptr_t;
typedef unsigned int __uintptr_t;
# 46 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/types.h" 2 3 4
# 54 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/types.h" 3 4
typedef long long mips_reg_t;
typedef unsigned long long mips_ureg_t;



typedef int mips_fpreg_t;
# 85 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/types.h" 3 4
typedef unsigned long paddr_t;
typedef unsigned long psize_t;

typedef unsigned long vaddr_t;
typedef unsigned long vsize_t;


typedef int register_t;
# 4 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/types.h" 2 3 4
# 48 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 2 3 4

# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/ansi.h" 1 3 4


# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/ansi.h" 1 3 4
# 41 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/ansi.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/int_types.h"
1 3 4
# 42 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/ansi.h" 2 3 4
# 88 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/ansi.h" 3 4
typedef union {
 char __mbstate8[128];
 __int64_t __mbstateL;
} __mbstate_t;
# 4 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/ansi.h" 2 3 4
# 50 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 2 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/int_types.h"
1 3 4
# 51 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 2 3 4


# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/ansi.h" 1 3 4
# 42 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/ansi.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/int_types.h"
1 3 4
# 43 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/ansi.h" 2 3 4

typedef char * __caddr_t;
typedef __uint32_t __gid_t;
typedef __uint32_t __in_addr_t;
typedef __uint16_t __in_port_t;
typedef __uint32_t __mode_t;
typedef __int64_t __off_t;
typedef __int32_t __pid_t;
typedef __uint8_t __sa_family_t;
typedef unsigned int __socklen_t;
typedef __uint32_t __uid_t;
# 54 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 2 3 4


typedef __int8_t int8_t;




typedef __uint8_t uint8_t;




typedef __int16_t int16_t;




typedef __uint16_t uint16_t;




typedef __int32_t int32_t;




typedef __uint32_t uint32_t;




typedef __int64_t int64_t;




typedef __uint64_t uint64_t;



typedef __uint8_t u_int8_t;
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;

# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/endian.h" 1 3 4


# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/endian.h" 1 3 4
# 49 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/endian.h" 3 4
# 1
"/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/endian_machdep.h"
1 3 4
# 11
"/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/endian_machdep.h"
3 4
# 1
"/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/endian_machdep.h" 1 3 4
# 12
"/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/endian_machdep.h"
2 3 4
# 50 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/endian.h" 2 3 4
# 81 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/endian.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 1 3 4
# 82 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/endian.h" 2 3 4


typedef __in_addr_t in_addr_t;




typedef __in_port_t in_port_t;




__uint32_t htonl (__uint32_t) __attribute__((__const__));
__uint16_t htons (__uint16_t) __attribute__((__const__));
__uint32_t ntohl (__uint32_t) __attribute__((__const__));
__uint16_t ntohs (__uint16_t) __attribute__((__const__));

# 126 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/endian.h" 3 4
# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/bswap.h" 1 3 4


# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/bswap.h" 1 3 4






# 1 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/bswap.h" 1 3 4
# 16 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/bswap.h" 3 4





u_int16_t bswap16 (u_int16_t) __asm__("__bswap16");
u_int32_t bswap32 (u_int32_t) __asm__("__bswap32");

u_int64_t bswap64 (u_int64_t);

# 8 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/mips/bswap.h" 2 3 4
# 4 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/bswap.h" 2 3 4
# 127 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/endian.h" 2 3 4
# 4 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/machine/endian.h" 2 3 4
# 101 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 2 3 4


typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;

typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;

typedef u_long cpuid_t;


typedef u_int64_t u_quad_t;
typedef __int64_t quad_t;
typedef quad_t * qaddr_t;
# 130 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 3 4
typedef quad_t longlong_t;
typedef u_quad_t u_longlong_t;

typedef __int64_t blkcnt_t;
typedef u_int32_t blksize_t;


typedef __caddr_t caddr_t;



typedef __int32_t daddr_t;
typedef u_int32_t dev_t;
typedef u_int32_t fixpt_t;


typedef __gid_t gid_t;



typedef u_int32_t id_t;
typedef u_int32_t ino_t;
typedef long key_t;


typedef __mode_t mode_t;



typedef u_int32_t nlink_t;


typedef __off_t off_t;




typedef __pid_t pid_t;



typedef quad_t rlim_t;
typedef __int32_t segsz_t;
typedef __int32_t swblk_t;


typedef __uid_t uid_t;



typedef __int32_t dtime_t;
# 205 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 3 4

__off_t lseek (int, __off_t, int);
int ftruncate (int, __off_t);
int truncate (const char *, __off_t);

# 225 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 3 4
typedef unsigned long clock_t;




typedef unsigned int size_t;





typedef int ssize_t;




typedef long time_t;




typedef int clockid_t;




typedef int timer_t;




typedef int suseconds_t;




typedef unsigned int useconds_t;
# 274 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 3 4
typedef __int32_t __fd_mask;
# 293 "/buildarea/cvs162/bin/destdir.sbmips.debug/usr/include/sys/types.h" 3 4
typedef struct fd_set {
 __fd_mask fds_bits[(((256) + (((sizeof(__fd_mask) * 8)) - 1)) /
((sizeof(__fd_mask) * 8)))];
} fd_set;
# 21 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/math_private.h" 2
# 58 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/math_private.h"
typedef union
{
  double value;
  struct
  {
    u_int32_t lsw;
    u_int32_t msw;
  } parts;
} ieee_double_shape_type;
# 131 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/math_private.h"
typedef union
{
  float value;
  u_int32_t word;
} ieee_float_shape_type;
# 156 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/math_private.h"
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_lgamma (double);
extern double __ieee754_gamma (double);
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 int __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 int*);



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_lgammaf (float);
extern float __ieee754_gammaf (float);
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 int __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 int*);
# 34 "/buildarea/cvs162/NetBSD162/src/lib/libm/src/e_acosh.c" 2


static const double



one = 1.0,
ln2 = 6.93147180559945286227e-01;


 double __ieee754_acosh(double x)




{
 double t;
 __int32_t hx;
 u_int32_t lx;
 do { ieee_double_shape_type ew_u; ew_u.value = (x); (hx) = ew_u.parts.msw; (lx)
= ew_u.parts.lsw; } while (0);
 if(hx<0x3ff00000) {
     return (x-x)/(x-x);
 } else if(hx >=0x41b00000) {
     if(hx >=0x7ff00000) {
         return x+x;
     } else
  return __ieee754_log(x)+ln2;
 } else if(((hx-0x3ff00000)|lx)==0) {
     return 0.0;
 } else if (hx > 0x40000000) {
     t=x*x;
     return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one)));
 } else {
     t = x-one;
     return log1p(t+sqrt(2.0*t+t*t));
 }
}

-- 
           Summary: Bogus reference to __divdf3 when -O1
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pkoning at equallogic dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-netbsdelf
  GCC host triplet: i386-netbsdelf
GCC target triplet: mipsel-netbsdelf


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



More information about the Gcc-bugs mailing list