This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: array bounds violation in caller-save.c : duplicate hard regs check added
dj@greed pts/0 ~/m32c/gcc/rl78-elf/gcc
$ ./cc1 -quiet -O3 qsort.i
DJERR: DUPLICATE HARD REG 12
../../../../../src/newlib/libc/search/qsort.c: In function 'qsort':
../../../../../src/newlib/libc/search/qsort.c:222:1: internal compiler error: in setup_save_areas, at caller-save.c:574
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
# 1 "../../../../../src/newlib/libc/search/qsort.c"
# 1 "/greed/dj/m32c/newlib/rl78-elf/rl78-elf/newlib/libc/search//"
# 1 "<command-line>"
# 1 "../../../../../src/newlib/libc/search/qsort.c"
# 77 "../../../../../src/newlib/libc/search/qsort.c"
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/_ansi.h" 1 3 4
# 15 "/greed/dj/m32c/newlib/src/newlib/libc/include/_ansi.h" 3 4
# 1 "/greed/dj/m32c/newlib/rl78-elf/rl78-elf/newlib/targ-include/newlib.h" 1 3 4
# 16 "/greed/dj/m32c/newlib/src/newlib/libc/include/_ansi.h" 2 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/config.h" 1 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/ieeefp.h" 1 3 4
# 5 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/config.h" 2 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/features.h" 1 3 4
# 6 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/config.h" 2 3 4
# 17 "/greed/dj/m32c/newlib/src/newlib/libc/include/_ansi.h" 2 3 4
# 78 "../../../../../src/newlib/libc/search/qsort.c" 2
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 1 3 4
# 10 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/ieeefp.h" 1 3 4
# 11 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 2 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/_ansi.h" 1 3 4
# 12 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 2 3 4
# 1 "/greed/dj/m32c/install/lib/gcc/rl78-elf/4.8.0/include/stddef.h" 1 3 4
# 213 "/greed/dj/m32c/install/lib/gcc/rl78-elf/4.8.0/include/stddef.h" 3 4
typedef unsigned int size_t;
# 325 "/greed/dj/m32c/install/lib/gcc/rl78-elf/4.8.0/include/stddef.h" 3 4
typedef long int wchar_t;
# 16 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 2 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/reent.h" 1 3 4
# 14 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/reent.h" 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/_types.h" 1 3 4
# 12 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/_types.h" 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_types.h" 1 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_default_types.h" 1 3 4
# 26 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_default_types.h" 3 4
typedef signed char __int8_t ;
typedef unsigned char __uint8_t ;
typedef signed int __int16_t;
typedef unsigned int __uint16_t;
# 46 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_default_types.h" 3 4
typedef __int16_t __int_least16_t;
typedef __uint16_t __uint_least16_t;
# 62 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_default_types.h" 3 4
typedef signed long __int32_t;
typedef unsigned long __uint32_t;
# 76 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_default_types.h" 3 4
typedef __int32_t __int_least32_t;
typedef __uint32_t __uint_least32_t;
# 99 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_default_types.h" 3 4
typedef signed long long __int64_t;
typedef unsigned long long __uint64_t;
# 8 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/_types.h" 2 3 4
# 13 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/_types.h" 2 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/lock.h" 1 3 4
typedef int _LOCK_T;
typedef int _LOCK_RECURSIVE_T;
# 14 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/_types.h" 2 3 4
typedef long _off_t;
typedef short __dev_t;
typedef unsigned short __uid_t;
typedef unsigned short __gid_t;
__extension__ typedef long long _off64_t;
typedef long _fpos_t;
# 58 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/_types.h" 3 4
typedef long _ssize_t;
# 1 "/greed/dj/m32c/install/lib/gcc/rl78-elf/4.8.0/include/stddef.h" 1 3 4
# 354 "/greed/dj/m32c/install/lib/gcc/rl78-elf/4.8.0/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 64 "/greed/dj/m32c/newlib/src/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 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/reent.h" 2 3 4
typedef unsigned long __ULong;
# 37 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/reent.h" 3 4
struct _reent;
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;
};
# 89 "/greed/dj/m32c/newlib/src/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;
};
# 105 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/reent.h" 3 4
struct __sbuf {
unsigned char *_base;
int _size;
};
# 169 "/greed/dj/m32c/newlib/src/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) (struct _reent *, void *, char *, int)
;
int (* _write) (struct _reent *, void *, const char *, int)
;
_fpos_t (* _seek) (struct _reent *, void *, _fpos_t, int);
int (* _close) (struct _reent *, void *);
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;
_mbstate_t _mbstate;
int _flags2;
};
# 273 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/reent.h" 3 4
typedef struct __sFILE __FILE;
struct _glue
{
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
# 305 "/greed/dj/m32c/newlib/src/newlib/libc/include/sys/reent.h" 3 4
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
# 580 "/greed/dj/m32c/newlib/src/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;
int _h_errno;
} _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];
};
# 818 "/greed/dj/m32c/newlib/src/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 *);
# 18 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 2 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/machine/stdlib.h" 1 3 4
# 19 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 2 3 4
# 1 "/greed/dj/m32c/newlib/src/newlib/libc/include/alloca.h" 1 3 4
# 21 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 2 3 4
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long quot;
long rem;
} ldiv_t;
typedef struct
{
long long int quot;
long long int rem;
} lldiv_t;
# 58 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 3 4
int __locale_mb_cur_max (void);
void abort (void) __attribute__ ((noreturn));
int abs (int);
int atexit (void (*__func)(void));
double atof (const char *__nptr);
float atoff (const char *__nptr);
int atoi (const char *__nptr);
int _atoi_r (struct _reent *, const char *__nptr);
long atol (const char *__nptr);
long _atol_r (struct _reent *, const char *__nptr);
void * bsearch (const void * __key, const void * __base, size_t __nmemb, size_t __size, int (* _compar) (const void *, const void *))
;
void * calloc (size_t __nmemb, size_t __size) ;
div_t div (int __numer, int __denom);
void exit (int __status) __attribute__ ((noreturn));
void free (void *) ;
char * getenv (const char *__string);
char * _getenv_r (struct _reent *, const char *__string);
char * _findenv (const char *, int *);
char * _findenv_r (struct _reent *, const char *, int *);
extern char *suboptarg;
int getsubopt (char **, char * const *, char **);
long labs (long);
ldiv_t ldiv (long __numer, long __denom);
void * malloc (size_t __size) ;
int mblen (const char *, size_t);
int _mblen_r (struct _reent *, const char *, size_t, _mbstate_t *);
int mbtowc (wchar_t *, const char *, size_t);
int _mbtowc_r (struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *);
int wctomb (char *, wchar_t);
int _wctomb_r (struct _reent *, char *, wchar_t, _mbstate_t *);
size_t mbstowcs (wchar_t *, const char *, size_t);
size_t _mbstowcs_r (struct _reent *, wchar_t *, const char *, size_t, _mbstate_t *);
size_t wcstombs (char *, const wchar_t *, size_t);
size_t _wcstombs_r (struct _reent *, char *, const wchar_t *, size_t, _mbstate_t *);
char * mkdtemp (char *);
int mkostemp (char *, int);
int mkostemps (char *, int, int);
int mkstemp (char *);
int mkstemps (char *, int);
char * mktemp (char *) __attribute__ ((__warning__ ("the use of `mktemp' is dangerous; use `mkstemp' instead")));
char * _mkdtemp_r (struct _reent *, char *);
int _mkostemp_r (struct _reent *, char *, int);
int _mkostemps_r (struct _reent *, char *, int, int);
int _mkstemp_r (struct _reent *, char *);
int _mkstemps_r (struct _reent *, char *, int);
char * _mktemp_r (struct _reent *, char *) __attribute__ ((__warning__ ("the use of `mktemp' is dangerous; use `mkstemp' instead")));
void qsort (void * __base, size_t __nmemb, size_t __size, int(*_compar)(const void *, const void *));
int rand (void);
void * realloc (void * __r, size_t __size) ;
void * reallocf (void * __r, size_t __size);
void srand (unsigned __seed);
double strtod (const char *__n, char **__end_PTR);
double _strtod_r (struct _reent *,const char *__n, char **__end_PTR);
float strtof (const char *__n, char **__end_PTR);
long strtol (const char *__n, char **__end_PTR, int __base);
long _strtol_r (struct _reent *,const char *__n, char **__end_PTR, int __base);
unsigned long strtoul (const char *__n, char **__end_PTR, int __base);
unsigned long _strtoul_r (struct _reent *,const char *__n, char **__end_PTR, int __base);
int system (const char *__string);
long a64l (const char *__input);
char * l64a (long __input);
char * _l64a_r (struct _reent *,long __input);
int on_exit (void (*__func)(int, void *),void * __arg);
void _Exit (int __status) __attribute__ ((noreturn));
int putenv (char *__string);
int _putenv_r (struct _reent *, char *__string);
void * _reallocf_r (struct _reent *, void *, size_t);
int setenv (const char *__string, const char *__value, int __overwrite);
int _setenv_r (struct _reent *, const char *__string, const char *__value, int __overwrite);
char * gcvt (double,int,char *);
char * gcvtf (float,int,char *);
char * fcvt (double,int,int *,int *);
char * fcvtf (float,int,int *,int *);
char * ecvt (double,int,int *,int *);
char * ecvtbuf (double, int, int*, int*, char *);
char * fcvtbuf (double, int, int*, int*, char *);
char * ecvtf (float,int,int *,int *);
char * dtoa (double, int, int, int *, int*, char**);
int rand_r (unsigned *__seed);
double drand48 (void);
double _drand48_r (struct _reent *);
double erand48 (unsigned short [3]);
double _erand48_r (struct _reent *, unsigned short [3]);
long jrand48 (unsigned short [3]);
long _jrand48_r (struct _reent *, unsigned short [3]);
void lcong48 (unsigned short [7]);
void _lcong48_r (struct _reent *, unsigned short [7]);
long lrand48 (void);
long _lrand48_r (struct _reent *);
long mrand48 (void);
long _mrand48_r (struct _reent *);
long nrand48 (unsigned short [3]);
long _nrand48_r (struct _reent *, unsigned short [3]);
unsigned short *
seed48 (unsigned short [3]);
unsigned short *
_seed48_r (struct _reent *, unsigned short [3]);
void srand48 (long);
void _srand48_r (struct _reent *, long);
long long atoll (const char *__nptr);
long long _atoll_r (struct _reent *, const char *__nptr);
long long llabs (long long);
lldiv_t lldiv (long long __numer, long long __denom);
long long strtoll (const char *__n, char **__end_PTR, int __base);
long long _strtoll_r (struct _reent *, const char *__n, char **__end_PTR, int __base);
unsigned long long strtoull (const char *__n, char **__end_PTR, int __base);
unsigned long long _strtoull_r (struct _reent *, const char *__n, char **__end_PTR, int __base);
void cfree (void *);
int unsetenv (const char *__string);
int _unsetenv_r (struct _reent *, const char *__string);
# 206 "/greed/dj/m32c/newlib/src/newlib/libc/include/stdlib.h" 3 4
char * _dtoa_r (struct _reent *, double, int, int, int *, int*, char**);
void * _malloc_r (struct _reent *, size_t) ;
void * _calloc_r (struct _reent *, size_t, size_t) ;
void _free_r (struct _reent *, void *) ;
void * _realloc_r (struct _reent *, void *, size_t) ;
void _mstats_r (struct _reent *, char *);
int _system_r (struct _reent *, const char *);
void __eprintf (const char *, const char *, unsigned int, const char *);
# 79 "../../../../../src/newlib/libc/search/qsort.c" 2
static inline char *med3 (char *, char *, char *, int (*)());
static inline void swapfunc (char *, char *, int, int);
# 106 "../../../../../src/newlib/libc/search/qsort.c"
static inline void
swapfunc(char *a , char *b , int n , int swaptype)
{
if(swaptype <= 1)
{ long i = (n) / sizeof (long); register long *pi = (long *) (a); register long *pj = (long *) (b); do { register long t = *pi; *pi++ = *pj; *pj++ = t; } while (--i > 0); }
else
{ long i = (n) / sizeof (char); register char *pi = (char *) (a); register char *pj = (char *) (b); do { register char t = *pi; *pi++ = *pj; *pj++ = t; } while (--i > 0); }
}
# 129 "../../../../../src/newlib/libc/search/qsort.c"
static inline char *
med3(char *a , char *b , char *c , int (*cmp)())
{
return cmp(a, b) < 0 ?
(cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
:(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c ));
}
void
qsort(void *a , size_t n , size_t es , int (*cmp)())
{
char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
int d, r, swaptype, swap_cnt;
loop: swaptype = ((char *)a - (char *)0) % sizeof(long) || es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;;
swap_cnt = 0;
if (n < 7) {
for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
pl -= es)
if (swaptype == 0) { long t = *(long *)(pl); *(long *)(pl) = *(long *)(pl - es); *(long *)(pl - es) = t; } else swapfunc(pl, pl - es, es, swaptype);
return;
}
pm = (char *) a + (n / 2) * es;
if (n > 7) {
pl = a;
pn = (char *) a + (n - 1) * es;
if (n > 40) {
d = (n / 8) * es;
pl = med3(pl, pl + d, pl + 2 * d, cmp);
pm = med3(pm - d, pm, pm + d, cmp);
pn = med3(pn - 2 * d, pn - d, pn, cmp);
}
pm = med3(pl, pm, pn, cmp);
}
if (swaptype == 0) { long t = *(long *)(a); *(long *)(a) = *(long *)(pm); *(long *)(pm) = t; } else swapfunc(a, pm, es, swaptype);
pa = pb = (char *) a + es;
pc = pd = (char *) a + (n - 1) * es;
for (;;) {
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
if (r == 0) {
swap_cnt = 1;
if (swaptype == 0) { long t = *(long *)(pa); *(long *)(pa) = *(long *)(pb); *(long *)(pb) = t; } else swapfunc(pa, pb, es, swaptype);
pa += es;
}
pb += es;
}
while (pb <= pc && (r = cmp(pc, a)) >= 0) {
if (r == 0) {
swap_cnt = 1;
if (swaptype == 0) { long t = *(long *)(pc); *(long *)(pc) = *(long *)(pd); *(long *)(pd) = t; } else swapfunc(pc, pd, es, swaptype);
pd -= es;
}
pc -= es;
}
if (pb > pc)
break;
if (swaptype == 0) { long t = *(long *)(pb); *(long *)(pb) = *(long *)(pc); *(long *)(pc) = t; } else swapfunc(pb, pc, es, swaptype);
swap_cnt = 1;
pb += es;
pc -= es;
}
if (swap_cnt == 0) {
for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
pl -= es)
if (swaptype == 0) { long t = *(long *)(pl); *(long *)(pl) = *(long *)(pl - es); *(long *)(pl - es) = t; } else swapfunc(pl, pl - es, es, swaptype);
return;
}
pn = (char *) a + n * es;
r = (pa - (char *)a) < (pb - pa) ? pa - (char *)a : pb - pa;
if ((r) > 0) swapfunc(a, pb - r, r, swaptype);
r = (pd - pc) < (pn - pd - es) ? pd - pc : pn - pd - es;
if ((r) > 0) swapfunc(pb, pn - r, r, swaptype);
if ((r = pb - pa) > es)
qsort(a, r / es, es, cmp);
if ((r = pd - pc) > es) {
a = pn - r;
n = r / es;
goto loop;
}
}