Bug 13318 - ICE: floating point exception in the loop optimizer
Summary: ICE: floating point exception in the loop optimizer
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.3.3
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2003-12-05 17:23 UTC by bremner@unb.ca
Modified: 2003-12-11 08:16 UTC (History)
1 user (show)

See Also:
Host: i?86-*-*
Target: i?86-*-*
Build: i?86-*-*
Known to work:
Known to fail:
Last reconfirmed: 2003-12-05 19:03:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bremner@unb.ca 2003-12-05 17:23:23 UTC
	when the included file is compile with optimization level 2, 
	an ICE (floating point exception) occurs

Environment:
System: FreeBSD convex.cs.unb.ca 5.1-CURRENT FreeBSD 5.1-CURRENT #8: Thu Nov 27 12:33:51 AST 2003 bremner@convex.cs.unb.ca:/usr/obj/usr/src/sys/CONVEX2 i386


	
host: i386-portbld-freebsd5.1
build: i386-portbld-freebsd5.1
target: i386-portbld-freebsd5.1
configured with: ./..//gcc-3.3-20031103/configure --disable-nls --with-gxx-include-dir=/usr/local/lib/gcc-lib/i386-portbld-freebsd5.1/3.3.3/include/c++/ --with-system-zlib --disable-shared --prefix=/usr/local i386-portbld-freebsd5.1

How-To-Repeat:
gcc -O2 test.i
where test.i is the following file. I was able to duplicate this
problem with gcc 3.0, and gcc 3.2 on a Debian box

# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
# 1 "hyperline.h" 1



# 1 "oms_types.h" 1



# 1 "/usr/include/stddef.h" 1 3 4
# 41 "/usr/include/stddef.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 42 "/usr/include/stddef.h" 2 3 4
# 1 "/usr/include/sys/_types.h" 1 3 4
# 33 "/usr/include/sys/_types.h" 3 4
# 1 "/usr/include/machine/_types.h" 1 3 4
# 45 "/usr/include/machine/_types.h" 3 4
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;







typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
# 70 "/usr/include/machine/_types.h" 3 4
typedef unsigned long __clock_t;
typedef __int32_t __critical_t;
typedef double __double_t;
typedef double __float_t;
typedef __int32_t __intfptr_t;
typedef __int64_t __intmax_t;
typedef __int32_t __intptr_t;
typedef __int32_t __int_fast8_t;
typedef __int32_t __int_fast16_t;
typedef __int32_t __int_fast32_t;
typedef __int64_t __int_fast64_t;
typedef __int8_t __int_least8_t;
typedef __int16_t __int_least16_t;
typedef __int32_t __int_least32_t;
typedef __int64_t __int_least64_t;
typedef __int32_t __ptrdiff_t;
typedef __int32_t __register_t;
typedef __int32_t __segsz_t;
typedef __uint32_t __size_t;
typedef __int32_t __ssize_t;
typedef __int32_t __time_t;
typedef __uint32_t __uintfptr_t;
typedef __uint64_t __uintmax_t;
typedef __uint32_t __uintptr_t;
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
typedef __uint64_t __uint_fast64_t;
typedef __uint8_t __uint_least8_t;
typedef __uint16_t __uint_least16_t;
typedef __uint32_t __uint_least32_t;
typedef __uint64_t __uint_least64_t;
typedef __uint32_t __u_register_t;
typedef __uint32_t __vm_offset_t;
typedef __int64_t __vm_ooffset_t;



typedef __uint32_t __vm_paddr_t;

typedef __uint64_t __vm_pindex_t;
typedef __uint32_t __vm_size_t;





typedef __builtin_va_list __va_list;





typedef __va_list __gnuc_va_list;
# 34 "/usr/include/sys/_types.h" 2 3 4




typedef __int32_t __clockid_t;
typedef __uint32_t __fflags_t;
typedef __uint64_t __fsblkcnt_t;
typedef __uint64_t __fsfilcnt_t;
typedef __uint32_t __gid_t;
typedef __int64_t __id_t;
typedef __uint32_t __ino_t;
typedef long __key_t;
typedef __uint16_t __mode_t;
typedef int __nl_item;
typedef __uint16_t __nlink_t;
typedef __int64_t __off_t;
typedef __int32_t __pid_t;
typedef __int64_t __rlim_t;
typedef __uint8_t __sa_family_t;
typedef __uint32_t __socklen_t;
typedef long __suseconds_t;
typedef __int32_t __timer_t;
typedef __uint32_t __udev_t;
typedef __uint32_t __uid_t;
typedef unsigned int __useconds_t;
# 78 "/usr/include/sys/_types.h" 3 4
typedef int __ct_rune_t;
typedef __ct_rune_t __rune_t;
typedef __ct_rune_t __wchar_t;
typedef __ct_rune_t __wint_t;
# 90 "/usr/include/sys/_types.h" 3 4
typedef __udev_t __dev_t;






typedef union {
        char __mbstate8[128];
        __int64_t _mbstateL;
} __mbstate_t;
# 43 "/usr/include/stddef.h" 2 3 4

typedef __ptrdiff_t ptrdiff_t;



typedef __rune_t rune_t;





typedef __size_t size_t;





typedef __wchar_t wchar_t;
# 5 "oms_types.h" 2
# 29 "oms_types.h"
typedef int index_t;


typedef int sign_t;
typedef int bool;
# 44 "oms_types.h"
typedef int natural_t;



typedef unsigned long rank_t;

# 1 "machtypes.h" 1




typedef int oms_int32;
typedef short oms_int16;
typedef char oms_int8;
typedef unsigned char oms_uint8;
typedef unsigned short oms_uint16;
typedef unsigned int oms_uint32;
# 51 "oms_types.h" 2



typedef char string[1024];

typedef struct kv_struct {
  int key;
  int val;
} key_val_t, *key_val_p;
# 5 "hyperline.h" 2
# 1 "statearray.h" 1





# 1 "sa_common.h" 1


# 1 "nalloc.h" 1
# 11 "nalloc.h"
# 1 "/usr/include/stdlib.h" 1 3 4
# 62 "/usr/include/stdlib.h" 3 4
typedef struct {
        int quot;
        int rem;
} div_t;

typedef struct {
        long quot;
        long rem;
} ldiv_t;
# 81 "/usr/include/stdlib.h" 3 4
extern int __mb_cur_max;



void abort(void) __attribute__((__noreturn__));
int abs(int) __attribute__((__const__));
int atexit(void (*)(void));
double atof(const char *);
int atoi(const char *);
long atol(const char *);
void *bsearch(const void *, const void *, size_t,
            size_t, int (*)(const void *, const void *));
void *calloc(size_t, size_t);
div_t div(int, int) __attribute__((__const__));
void exit(int) __attribute__((__noreturn__));
void free(void *);
char *getenv(const char *);
long labs(long) __attribute__((__const__));
ldiv_t ldiv(long, long) __attribute__((__const__));
void *malloc(size_t);
int mblen(const char *, size_t);
size_t mbstowcs(wchar_t * , const char * , size_t);
int mbtowc(wchar_t * , const char * , size_t);
void qsort(void *, size_t, size_t,
            int (*)(const void *, const void *));
int rand(void);
void *realloc(void *, size_t);
void srand(unsigned);
double strtod(const char * , char ** );
float strtof(const char * , char ** );
long strtol(const char * , char ** , int);
long double
         strtold(const char * , char ** );
unsigned long
         strtoul(const char * , char ** , int);
int system(const char *);
int wctomb(char *, wchar_t);
size_t wcstombs(char * , const wchar_t * , size_t);
# 133 "/usr/include/stdlib.h" 3 4
typedef struct {
        long long quot;
        long long rem;
} lldiv_t;


long long
         atoll(const char *);

long long
         llabs(long long) __attribute__((__const__));

lldiv_t lldiv(long long, long long) __attribute__((__const__));

long long
         strtoll(const char * , char ** , int);

unsigned long long
         strtoull(const char * , char ** , int);


void _Exit(int) __attribute__((__noreturn__));
# 164 "/usr/include/stdlib.h" 3 4
int rand_r(unsigned *);
int setenv(const char *, const char *, int);
void unsetenv(const char *);
# 178 "/usr/include/stdlib.h" 3 4
double drand48(void);

double erand48(unsigned short[3]);



int getsubopt(char **, char *const *, char **);


int grantpt(int);
char *initstate(unsigned long , char *, long);
long jrand48(unsigned short[3]);

void lcong48(unsigned short[7]);
long lrand48(void);

int mkstemp(char *);



char *mktemp(char *);


long mrand48(void);
long nrand48(unsigned short[3]);
int posix_openpt(int);
char *ptsname(int);
int putenv(const char *);
long random(void);
char *realpath(const char *, char resolved_path[]);
unsigned short
        *seed48(unsigned short[3]);

int setkey(const char *);


char *setstate( char *);
void srand48(long);
void srandom(unsigned long);
int unlockpt(int);



extern const char *_malloc_options;
extern void (*_malloc_message)(const char *, const char *, const char *,
            const char *);
# 241 "/usr/include/stdlib.h" 3 4
__uint32_t
         arc4random(void);
void arc4random_addrandom(unsigned char *dat, int datlen);
void arc4random_stir(void);
char *getbsize(int *, long *);

char *cgetcap(char *, const char *, int);
int cgetclose(void);
int cgetent(char **, char **, const char *);
int cgetfirst(char **, char **);
int cgetmatch(const char *, const char *);
int cgetnext(char **, char **);
int cgetnum(char *, const char *, long *);
int cgetset(const char *);
int cgetstr(char *, const char *, char **);
int cgetustr(char *, const char *, char **);

int daemon(int, int);
char *devname(int, int);
char *devname_r(int, int, char *, int);
int getloadavg(double [], int);
const char *
         getprogname(void);

int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
void qsort_r(void *, size_t, size_t, void *,
            int (*)(void *, const void *, const void *));
int radixsort(const unsigned char **, int, const unsigned char *,
            unsigned);
void *reallocf(void *, size_t);
void setprogname(const char *);
int sradixsort(const unsigned char **, int, const unsigned char *,
            unsigned);
void sranddev(void);
void srandomdev(void);


__int64_t
         strtoq(const char *, char **, int);
__uint64_t
         strtouq(const char *, char **, int);


# 12 "nalloc.h" 2
# 20 "nalloc.h"
typedef int na_offset_t;
typedef int na_slot_t,na_handle,slot_t;
# 43 "nalloc.h"
struct na_node_struct;
typedef void (* na_func)(struct na_node_struct *, na_slot_t slot);
typedef struct na_desc_struct{
  na_offset_t offset;
  size_t size;
  bool in_use;
  bool dangles;
  void *ptr;
  index_t fixup_tag;
  index_t destroy_tag;
  index_t forget_tag;
  index_t report_tag;
} na_desc_t, *na_desc_p;



typedef struct na_node_struct{
  long tag;
  bool frozen;
  size_t size;
  size_t limit;
  na_desc_t chunk[100];
  char mem[1];
} na_node_t, *na_node_p;
# 93 "nalloc.h"
void *na_access(na_node_p,na_slot_t);
void *na_realloc(na_node_p,na_slot_t,size_t);
void na_destroy(na_node_p);
na_node_p na_new(int);
na_node_p na_new1(int,size_t);

na_node_p na_alloc(na_node_p,na_slot_t,size_t);
void na_copy(na_node_p,na_node_p);
na_node_p na_freeze(na_node_p);
na_node_p na_compact(na_node_p);
size_t na_size(na_node_p);
void na_sanity_check(char*,na_node_p);
void na_fixup(na_node_p);
void na_cleanup(na_node_p);
void na_set_fixup(na_node_p,na_slot_t,index_t);
void na_set_destroy(na_node_p,na_slot_t,index_t);
void na_set_forget(na_node_p,na_slot_t,index_t);
void na_set_report(na_node_p,na_slot_t,index_t);
void na_report(na_node_p);
void na_fatal(char *);

extern na_func na_jump_table[];
# 4 "sa_common.h" 2


# 1 "sa_slots.h" 1
# 7 "sa_common.h" 2
# 1 "/usr/include/limits.h" 1 3 4
# 128 "/usr/include/limits.h" 3 4
# 1 "/usr/include/sys/limits.h" 1 3 4
# 40 "/usr/include/sys/limits.h" 3 4
# 1 "/usr/include/machine/_limits.h" 1 3 4
# 41 "/usr/include/sys/limits.h" 2 3 4
# 129 "/usr/include/limits.h" 2 3 4


# 1 "/usr/include/sys/syslimits.h" 1 3 4
# 132 "/usr/include/limits.h" 2 3 4
# 8 "sa_common.h" 2
# 7 "statearray.h" 2


# 1 "sa32_array.h" 1
# 11 "sa32_array.h"
typedef oms_int32 sa_base_t;
typedef oms_uint32 sa_ubase_t;
typedef oms_int32 sa_index_t;
# 25 "sa32_array.h"
# 1 "oms_opt.h" 1
# 10 "oms_opt.h"
enum ndebug_e {OPT_ndebug=0 };






enum oms_ndebug_e {OPT_oms_ndebug=0 };






enum use_efence_e {OPT_use_efence=0 };






enum use_dmalloc_e {OPT_use_dmalloc=0 };






enum have_ilogb_e {OPT_have_ilogb=0 };






enum have_index_t_e {OPT_have_index_t=0 };






enum hls_shortcut_e {OPT_hls_shortcut=0 };






enum use_zram_e {OPT_use_zram=0 };






enum inline_e {OPT_inline=0 };






enum use_profile_e {OPT_use_profile=0 };






enum detailed_profile_e {OPT_detailed_profile=0 };






enum oms_checkpointtime_e {OPT_oms_checkpointtime=0 };






enum var_stack_e {OPT_var_stack=0 };






enum compress_stack_e {OPT_compress_stack=0 };






enum oms_debuglevel_e {OPT_oms_debuglevel=0 };






enum oms_subtreelimit_e {OPT_oms_subtreelimit=0 };






enum yyerror_verbose_e {OPT_yyerror_verbose=0 };






enum yydebug_e {OPT_yydebug=0 };






enum be_store_sign_e {OPT_be_store_sign=0 };






enum be_store_row_e {OPT_be_store_row=0 };






enum be_store_col_e {OPT_be_store_col=0 };






enum be_store_row_start_e {OPT_be_store_row_start=0 };
# 26 "sa32_array.h" 2
# 1 "array_backup_stack.h" 1



# 1 "array_backup.h" 1
# 9 "array_backup.h"
typedef enum { AB_STACK=0 } ab_strat_t;

typedef struct ab_struct {
  ab_strat_t strategy;
  index_t stack_top;
  size_t stack_size;
  key_val_p stack;
  struct ab_struct *next;
} array_backup_t, *array_backup_p, *ab_p, ab_t;

array_backup_p ab_new(int size);
void ab_destroy(array_backup_p back);
void ab_restore8(array_backup_p back, oms_int8 *array);
void ab_restore16(array_backup_p back, oms_int16 *array);
void ab_restore32(array_backup_p back, oms_int32 *array);
void ab_set(array_backup_p back, int key, int val);
# 5 "array_backup_stack.h" 2

typedef struct{
        int dictsize;
        array_backup_p top;
} abs_t, *abs_p;

abs_p abs_new(int dictsize);
ab_p abs_top(abs_p stack);
void abs_destroy(abs_p stack);
void abs_push(abs_p stack);
void abs_pop(abs_p stack);
void abs_set(abs_p stack, int key, int val);
void abs_report(abs_p stack);
# 27 "sa32_array.h" 2
# 39 "sa32_array.h"
typedef struct {sa_index_t index; sa_base_t value;} sa_iv_pair_t, *sa_iv_pair_p;

typedef struct {
  sa_index_t size;
  abs_p stack;
  int stacksize;
  sa_base_t *array;
} sa_array_t, *sa_array_p;





sa_array_p sa_new(size_t,size_t);
na_node_p sa_nalloc(na_node_p p,index_t slot, size_t asize,size_t ssize);
void sa_fixup(na_node_p, index_t slot);
sa_base_t sa_read(sa_array_p,sa_index_t);
sa_base_t sa_increment(sa_array_p, sa_index_t);

sa_index_t sa_size(sa_array_p);

int sa_stackdump(sa_array_p,bool);

void sa_set(sa_array_p, sa_index_t, sa_base_t);
void sa_init(sa_array_p, sa_index_t, sa_base_t);
void sa_fatal(char *);
void sa_save(sa_array_p);
void sa_restore(sa_array_p);
sa_base_t sa_or(sa_array_p, sa_index_t, sa_base_t);
sa_base_t sa_or2(sa_array_p, sa_index_t, sa_base_t);
sa_base_t sa_set_bits(sa_array_p, sa_index_t, sa_base_t, sa_index_t, sa_index_t);
void sa_sanity_check(char *,sa_array_p);
index_t sa_zeros(sa_array_p S);

void sa_fixup(na_node_p,na_slot_t);
void sa_destroy(na_node_p,na_slot_t);
void sa_report(na_node_p,na_slot_t);
# 86 "sa32_array.h"
typedef sa_array_t sarray_t,*sarray_p;
typedef sa_base_t base_t;
# 10 "statearray.h" 2
# 6 "hyperline.h" 2


# 1 "hl_slots.h" 1
# 9 "hyperline.h" 2
# 1 "basis_equation.h" 1






# 1 "sa16_array.h" 1
# 13 "sa16_array.h"
typedef oms_int16 sa16_base_t;
typedef oms_uint16 sa16_ubase_t;

typedef oms_int32 sa16_index_t;
# 43 "sa16_array.h"
typedef struct {sa16_index_t index; sa16_base_t value;} sa16_iv_pair_t, *sa16_iv_pair_p;

typedef struct {
  sa16_index_t size;
  abs_p stack;
  int stacksize;
  sa16_base_t *array;
} sa16_array_t, *sa16_array_p;





sa16_array_p sa16_new(size_t,size_t);
na_node_p sa16_nalloc(na_node_p p,index_t slot, size_t asize,size_t ssize);
void sa16_fixup(na_node_p, index_t slot);
sa16_base_t sa16_read(sa16_array_p,sa16_index_t);
sa16_base_t sa16_increment(sa16_array_p, sa16_index_t);

sa16_index_t sa16_size(sa16_array_p);

int sa16_stackdump(sa16_array_p,bool);

void sa16_set(sa16_array_p, sa16_index_t, sa16_base_t);
void sa16_init(sa16_array_p, sa16_index_t, sa16_base_t);
void sa16_fatal(char *);
void sa16_save(sa16_array_p);
void sa16_restore(sa16_array_p);
sa16_base_t sa16_or(sa16_array_p, sa16_index_t, sa16_base_t);
sa16_base_t sa16_or2(sa16_array_p, sa16_index_t, sa16_base_t);
sa16_base_t sa16_set_bits(sa16_array_p, sa16_index_t, sa16_base_t, sa16_index_t, sa16_index_t);
void sa16_sanity_check(char *,sa16_array_p);
index_t sa16_zeros(sa16_array_p S);

void sa16_fixup(na_node_p,na_slot_t);
void sa16_destroy(na_node_p,na_slot_t);
void sa16_report(na_node_p,na_slot_t);
# 8 "basis_equation.h" 2
# 1 "signed_set.h" 1




# 1 "signed_index.h" 1



typedef int signed_index_t;
# 6 "signed_set.h" 2
# 1 "int_queue.h" 1






typedef struct iq_struct {
  natural_t size;
  natural_t head;
  natural_t tail;
  int elem[1];
} int_queue_t, *int_queue_p;

extern int iq_first(int_queue_p);
extern int_queue_p iq_new(natural_t);
extern int iq_empty(int_queue_p);
extern int iq_count(int_queue_p);
extern int iq_full(int_queue_p);
extern int iq_deq(int_queue_p);
extern void iq_destroy(int_queue_p);
extern void iq_flush(int_queue_p);
extern void iq_enq(int_queue_p, int);
extern na_node_p iq_nalloc(na_node_p, slot_t, natural_t);
# 7 "signed_set.h" 2

typedef struct {
  natural_t size;
  int_queue_p queue;
  int present[1];
} signed_set_t, *signed_set_p;

signed_set_p ss_new(int);

bool ss_add(signed_set_p,int,int);

int ss_count(signed_set_p);

int ss_deq(signed_set_p);

bool ss_empty(signed_set_p);

void ss_destroy(signed_set_p);
# 9 "basis_equation.h" 2
# 1 "bitmask.h" 1
# 12 "bitmask.h"
# 1 "/usr/include/math.h" 1 3 4
# 25 "/usr/include/math.h" 3 4
extern const union __infinity_un {
        unsigned char __uc[8];
        double __ud;
} __infinity;

extern const union __nan_un {
        unsigned char __uc[sizeof(float)];
        float __uf;
} __nan;
# 70 "/usr/include/math.h" 3 4
typedef __double_t double_t;
typedef __float_t float_t;
# 92 "/usr/include/math.h" 3 4
extern int signgam;


enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
# 107 "/usr/include/math.h" 3 4
extern enum fdversion _fdlib_version;
# 117 "/usr/include/math.h" 3 4
struct exception {
        int type;
        char *name;
        double arg1;
        double arg2;
        double retval;
};
# 159 "/usr/include/math.h" 3 4




int __fpclassifyd(double) __attribute__((__const__));
int __fpclassifyf(float) __attribute__((__const__));
int __fpclassifyl(long double) __attribute__((__const__));
int __signbit(double) __attribute__((__const__));

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) __attribute__((__const__));
int finite(double) __attribute__((__const__));
double gamma(double);
double hypot(double, 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) __attribute__((__const__));
double logb(double) __attribute__((__const__));
double nextafter(double, double);
double remainder(double, double);
double scalb(double, double);
double tgamma(double);


int matherr(struct exception *);





double significand(double);




double copysign(double, double) __attribute__((__const__));
int ilogb(double);
double rint(double) __attribute__((__const__));
double scalbn(double, int);




double drem(double, double);
double expm1(double) __attribute__((__const__));
double log1p(double) __attribute__((__const__));






double gamma_r(double, int *);
double lgamma_r(double, int *);



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) __attribute__((__const__));
int finitef(float) __attribute__((__const__));
float gammaf(float);
float hypotf(float, float) __attribute__((__const__));
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) __attribute__((__const__));
float logbf(float) __attribute__((__const__));
float nextafterf(float, float);
float remainderf(float, float);
float scalbf(float, float);




float significandf(float);





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




float dremf(float, float);
float expm1f(float) __attribute__((__const__));
float log1pf(float) __attribute__((__const__));







float gammaf_r(float, int *);
float lgammaf_r(float, int *);
# 360 "/usr/include/math.h" 3 4
long double fabsl(long double);
# 407 "/usr/include/math.h" 3 4

# 13 "bitmask.h" 2
# 39 "bitmask.h"
typedef oms_uint32 bitmask_t;
# 10 "basis_equation.h" 2
# 1 "nu_sign.h" 1



# 1 "nu_sign_encoding.h" 1



typedef enum sign_encoding_enum{
 SIGN_NEG=4 ,
SIGN_ZERO=2 ,
SIGN_POS=1 ,
SIGN_ANY=7 ,
SIGN_NONE=0 ,
SIGN_NONZERO=5 ,
SIGN_NONNEG=3 ,
SIGN_NONPOS=6 } nu_sign_t,*nu_sign_p;
# 27 "nu_sign_encoding.h"
extern const char *sign_name[];
# 5 "nu_sign.h" 2
# 22 "nu_sign.h"
int sign_int(nu_sign_t sigma);
nu_sign_t int_sign(int i);
# 11 "basis_equation.h" 2
# 1 "be_struct.h" 1






typedef struct be_coeff_struct {




  signed_index_t sindex;

  index_t prev;
# 24 "be_struct.h"
} be_coeff_t,*be_coeff_p;
# 59 "be_struct.h"
typedef struct be_struct {
  bool initialized;
  int rows,cols,stride,bases;
  index_t source,sink,diameter;
  oms_int32 ones_mask;
  index_t *last;
  bitmask_t *row_mask;
  be_coeff_t *eqn;
} be_block_t, *be_block_p;
# 12 "basis_equation.h" 2
# 1 "ridge_graph.h" 1







typedef struct rg_struct {
  natural_t dim;

  natural_t elements;
  natural_t bases;
  index_t source;
  index_t sink;
  natural_t diameter;
  sa_array_p source_dist;
  sa_array_p sink_dist;
} ridge_graph_t,*ridge_graph_p;


typedef ridge_graph_p ridge_graph;

# 1 "bindex_table.h" 1





# 1 "basis_equation.h" 1
# 7 "bindex_table.h" 2


typedef struct bindex_table_struct {
  natural_t rows,cols,depth;
  index_t data[1];
} bindex_table_t, *bindex_table_p;

extern na_node_p bt_nalloc(na_node_p, slot_t, size_t, size_t, size_t);
# 24 "ridge_graph.h" 2




extern na_node_p rg_nalloc(na_node_p, slot_t, natural_t, natural_t,
                           index_t, index_t, natural_t);

extern bool rg_add_facet(ridge_graph, index_t, sarray_p, be_block_p);
extern void rg_dump(ridge_graph);
extern void rg_restore(ridge_graph);
extern void rg_save(ridge_graph);
extern void rg_fixup(na_node_p,slot_t);
# 13 "basis_equation.h" 2

# 1 "oms_hook.h" 1






typedef bool (* oms_hook)(struct na_node_struct *,struct na_node_struct *,
                          int,int);
# 15 "basis_equation.h" 2

# 1 "nu_sign_set.h" 1




# 1 "nu_signed_index.h" 1
# 17 "nu_signed_index.h"
typedef oms_uint32 nu_signed_index_t;
# 6 "nu_sign_set.h" 2




typedef struct nu_sign_set_struct {
  natural_t size;
  int_queue_p queue;
  bool *present;
  nu_sign_p sign;
} nu_sign_set_t, *nu_sign_set_p;


nu_sign_set_p nss_new(natural_t ssize);
void nss_dump(nu_sign_set_p ss);
void nss_fixup(na_node_p node, slot_t slot);
na_node_p nss_nalloc(na_node_p node, slot_t slot, natural_t ssize);
void nss_destroy(nu_sign_set_p S);
bool nss_add(nu_sign_set_p S, int k, nu_sign_t sign);
int nss_empty(nu_sign_set_p S);
int nss_count(nu_sign_set_p S);
nu_signed_index_t nss_deq(nu_sign_set_p S);
index_t nss_deq_index(nu_sign_set_p S);
nu_signed_index_t nss_next(nu_sign_set_p S);
# 17 "basis_equation.h" 2


be_block_p be_alloc(size_t rows, size_t cols, size_t bases);
void be_fixup(na_node_p node, index_t slot);
na_node_p be_nalloc(na_node_p node, index_t slot, size_t rows, size_t cols, size_t bases);
index_t be_bases(be_block_p BE);
index_t be_cols(be_block_p BE);
index_t be_rows(be_block_p BE);
index_t be_bindex(be_block_p BE, index_t row, index_t col);
index_t be_sign(be_block_p BE, index_t row, index_t col);
void be_set_bindex(be_block_p BE, index_t row, index_t col, index_t val);
void be_set_sign(be_block_p BE, index_t row, index_t col, index_t val);
void be_makelinks(be_block_p be);
void be_dump(be_block_p BE);
nu_sign_t be_update_mask(sarray_p mask_array, nu_sign_t which, index_t row, index_t col, nu_sign_t sigma);
void be_check_mask(na_node_p global,be_block_p BE, index_t row, bitmask_t mask, nu_sign_t sigma, sarray_p chi);
bool be_nonmonotone_row(be_block_p BE, index_t elem, nu_sign_t sigma, bitmask_t pmask, bitmask_t nmask, bitmask_t zmask, nu_sign_set_p forced);
# 10 "hyperline.h" 2
# 18 "hyperline.h"
struct hyperline_cell_struct {
  index_t bindex;
  int sign;

  int real_sign;
  rank_t key;
  index_t row;
  natural_t mu;
  int tau;
  index_t rnext,rprev;
  index_t cnext;
};
typedef struct hyperline_cell_struct hl_cell_t, *hl_cell_p;

struct hyperline_cfg_struct {
  int inited;
  sarray_p clist;
  sarray_p left,right;
  sarray_p ridge;
  index_t rows,cols,rank;
  index_t max_rows,max_cols;
  index_t coltop;

  size_t colstacksize;
  index_t *row_bindex;

  index_t *row_hlindex;

  index_t *hlindex_row;
  index_t *mu_last,*colstack;
  index_t *bindex_table;


  hl_cell_t cell[1];
};


typedef struct hyperline_cfg_struct hyperline_cfg_t, *hyperline_cfg_p,hl_cfg_t,*hl_cfg_p;


bool hl_set_sign(hl_cfg_p H, sarray_p chirotope, index_t bindex, sign_t sign);
void hl_save(hl_cfg_p H);
void hl_restore(hl_cfg_p H);
rank_t hl_key(hl_cfg_p H, index_t i);
bool hl_lfeasible(hl_cfg_p H, index_t i);
int hl_new_sign(hl_cfg_p H, index_t line, sarray_p chirotope);
int hl_new_real_sign(hl_cfg_p H, index_t line, sarray_p chirotope);
bool hl_update(na_node_p local, na_node_p global, hl_cfg_p H, sarray_p chirotope);
bool hl_check_boundary(hl_cfg_p H, sarray_p chirotope, index_t row, index_t k);
index_t hl_rows(hl_cfg_p H);
index_t hl_cols(hl_cfg_p H);
index_t hl_max_cols(hl_cfg_p H);
index_t hl_sign(hl_cfg_p H, index_t i);
index_t hl_tau(hl_cfg_p H, index_t i);
index_t hl_real_sign(hl_cfg_p H, index_t i);
index_t hl_index(hl_cfg_p H, index_t i);
index_t hl_index_inv(hl_cfg_p H, index_t bindex);
na_node_p hl_nalloc(na_node_p node, index_t slot, int n, int r);
void hl_fixup(na_node_p node, index_t slot);
void hl_init(hl_cfg_p H, int n, int r, sign_t chi0);
index_t hl_left(hl_cfg_p H, index_t line);
index_t hl_right(hl_cfg_p H, index_t line);
void hl_set_right(hl_cfg_p H, index_t line, index_t val);
void hl_set_left(hl_cfg_p H, index_t line, index_t val);
index_t hl_toright(hl_cfg_p H, index_t line, index_t k);
index_t hl_rnext(hl_cfg_p H, index_t k);
index_t hl_rprev(hl_cfg_p H, index_t k);
index_t hl_head(hl_cfg_p H, index_t line);
void hl_dump_line(hl_cfg_p H, int line);
void hl_dump(hl_cfg_p H);
bool hl_set_gaps(na_node_p local, na_node_p global, sarray_p chirotope, hl_cfg_p H, index_t table_beta, sign_t sign);
bool hl_check_alternation(hl_cfg_p H, index_t row);
bool hl_set_ridges(hl_cfg_p H, index_t b, be_block_p ridge_table);
# 2 "test.c" 2
# 1 "hl_internal.h" 1
# 22 "hl_internal.h"
static void hl_rollback(hl_cfg_p);
static bool hl_feasible(hl_cfg_p, index_t);
static bool hl_cmp(int, int, index_t *, natural_t, natural_t, natural_t, sarray_p);
static void hl_sort(int n, int r, index_t *pi,index_t pi0, index_t *pibar, size_t len,
                    index_t *tau,
                    sarray_p chirotope,
                    index_t *work);
static void hl_coeff_insert(hl_cfg_p H, index_t where, index_t bindex);

extern bool SetSign(na_node_p, na_node_p, index_t, sign_t);

static void hl_init_bindex_table(int *t, int n, int r);
static void hl_preinit(hl_cfg_p H, index_t n, index_t r);
# 3 "test.c" 2


extern void hl_init(hl_cfg_p H,int n, int r,sign_t chi0){

  int i,line;
  int *pi,pibar[2],tau[2];

  pi=calloc(r,sizeof(int));
# 20 "test.c"
  do {

    index_t k=hl_head(H,line);
# 33 "test.c"
    for (i=0; i<2; i++){
      index_t beta;
      hl_cell_p cell=H->cell+k+i;


      cell->key=i*(0xffffffffUL/2);
      cell->row=line;

      pi[r-2]=pibar[i];
      beta=kset_cindex(n,r,pi);
      cell->bindex=beta;
      cell->mu=pibar[i];
      cell->tau=tau[i];
# 56 "test.c"
      cell->rnext=k+(1-i);
      cell->rprev=k+(1-i);
      hl_coeff_insert(H,k+i,beta);

    }

    line++;
  } while (next_kpartition(r,r-2,pi,pibar,tau));
  H->rows=line;

  H->inited=1;
}
Comment 1 bremner@unb.ca 2003-12-05 17:23:23 UTC
Fix:
	
	The problem does not occcur at optimization level 1
Comment 2 Wolfgang Bangerth 2003-12-05 17:47:39 UTC
Confirmed. Here's a cut-down: 
------------------------- 
struct S { 
  int key; 
  int rnext,rprev; 
}; 
 
void foo(struct S* H){ 
  int i, k; 
  for (i=0; i<2; i++){ 
    struct S* cell=H+k; 
    cell->key=i*(0xffffffffUL/2); 
    cell->rnext=k+(1-i); 
    cell->rprev=k+(1-i); 
  } 
} 
-------------------------- 
this also ICEs on my x86-linux box: 
 
g/x> /home/bangerth/bin/gcc-3.3.3-pre/bin/gcc -c -O2 x.c 
x.c: In function `foo': 
x.c:14: internal compiler error: Floating point exception 
 
The same thing happens with mainline and all the way back to 2.95. 
W. 
Comment 3 Eric Botcazou 2003-12-05 18:18:20 UTC
Ouch! Division by zero... I'll investigate.
Comment 4 Andrew Pinski 2003-12-05 19:03:52 UTC
Looks like even though I thought const_int rtx's were shared it looks like they are not?
7198          if (g1->mult_val == const0_rtx
7199              || INTVAL (g2->mult_val) % INTVAL (g1->mult_val) != 0)
Comment 5 Eric Botcazou 2003-12-05 19:58:00 UTC
They are, and I was wrong when I said it's a division by zero: it's an integer
overflow! It seems that all arithmetic operations raise SIGFPE on x86.
Comment 6 Andrew Pinski 2003-12-06 11:56:11 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2003-12/msg00629.html>.
Comment 7 CVS Commits 2003-12-07 12:57:17 UTC
Subject: Bug 13318

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ebotcazou@gcc.gnu.org	2003-12-07 12:57:13

Modified files:
	gcc            : ChangeLog loop.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: overflow-1.c 

Log message:
	PR optimization/13318
	* loop.c (express_from): Protect integer division from overflow.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1944&r2=2.1945
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&r1=1.476&r2=1.477
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3236&r2=1.3237
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/overflow-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 8 Eric Botcazou 2003-12-07 13:09:43 UTC
I'll backport it in a few days.
Comment 10 Eric Botcazou 2003-12-11 08:16:11 UTC
See the aforementioned link.