public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Assertion failure during IRA (df_scan.c)
@ 2011-04-01 10:49 Georg-Johann Lay
  0 siblings, 0 replies; only message in thread
From: Georg-Johann Lay @ 2011-04-01 10:49 UTC (permalink / raw)
  To: gcc; +Cc: Vladimir Makarov

[-- Attachment #1: Type: text/plain, Size: 5202 bytes --]

With the changed IRA there occurs assertion failure of some inline
asm, find precompiled source attached. Seem as if something goes wrong
with FP elimination. The precompiled source is from avr-libc and
compiled fine with older versions/revisions.

avr-gcc 4.7.0 as of SVN 171824, configured
../../gcc.gnu.org/trunk/configure --target=avr
--prefix=/local/gnu/install/gcc-4.6 --enable-languages=c,c++
--disable-libssp --disable-libada --disable-nls --disable-shared


(gdb) set args -quiet -v -iprefix
/local/gnu/build/gcc-4.6-avr/gcc/../lib/gcc/avr/4.7.0/ -isystem
/mnt/nfs/home/georg/gnu/build/gcc-4.6-avr/gcc/include -isystem
/mnt/nfs/home/georg/gnu/build/gcc-4.6-avr/gcc/include-fixed strtod-i.c
-quiet -dumpbase strtod-i.c -auxbase strtod-i -Os -version -o strtod-i.s
(gdb) cd ~/test
(gdb) r
GNU C (GCC) version 4.7.0 20110401 (experimental) (avr)
	compiled by GNU C version 4.3.2 [gcc-4_3-branch revision 141291], GMP
version 5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2
[...]
End of search list.
GNU C (GCC) version 4.7.0 20110401 (experimental) (avr)
	compiled by GNU C version 4.3.2 [gcc-4_3-branch revision 141291], GMP
version 5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: fb8553d013d52c3a76f93f359d3bc754
strtod-i.c: In function 'strtod':
strtod-i.c:834:106: error: can't find a register in class
'POINTER_REGS' while reloading 'asm'
strtod-i.c:834:106: error: 'asm' operand has impossible constraints
strtod-i.c:482:5: error: 'asm' operand has impossible constraints

Breakpoint 1, fancy_abort (file=0x87d7b80
"../../../gcc.gnu.org/trunk/gcc/df-scan.c", line=2841,
function=0x87d826f "df_ref_record") at
../../../gcc.gnu.org/trunk/gcc/diagnostic.c:893
(gdb) bt
#0  fancy_abort (file=0x87d7b80
"../../../gcc.gnu.org/trunk/gcc/df-scan.c", line=2841,
function=0x87d826f "df_ref_record") at
../../../gcc.gnu.org/trunk/gcc/diagnostic.c:893
#1  0x081e275b in df_ref_record (cl=DF_REF_REGULAR,
collection_rec=0xbfffe46c, reg=0xb7c67ae0, loc=0xb7e57c44,
bb=0xb7ddfc80, insn_info=0x890aacc, ref_type=DF_REF_REG_DEF,
ref_flags=32800) at ../../../gcc.gnu.org/trunk/gcc/df-scan.c:2841
#2  0x081e2f77 in df_uses_record (collection_rec=0xbfffe46c,
loc=<value optimized out>, ref_type=DF_REF_REG_MEM_LOAD,
bb=0xb7ddfc80, insn_info=0x890aacc, flags=0) at
../../../gcc.gnu.org/trunk/gcc/df-scan.c:3243
#3  0x081e2e20 in df_uses_record (collection_rec=0xbfffe46c,
loc=<value optimized out>, ref_type=DF_REF_REG_USE, bb=0xb7ddfc80,
insn_info=0x890aacc, flags=<value optimized out>) at
../../../gcc.gnu.org/trunk/gcc/df-scan.c:3124
#4  0x081e3a86 in df_insn_refs_collect (collection_rec=0xbfffe46c,
bb=0xb7ddfc80, insn_info=0x890aacc) at
../../../gcc.gnu.org/trunk/gcc/df-scan.c:3451
#5  0x081e6a4a in df_bb_refs_record (bb_index=33, scan_insns=1 '\001')
at ../../../gcc.gnu.org/trunk/gcc/df-scan.c:3585
#6  0x081e6c63 in df_scan_blocks () at
../../../gcc.gnu.org/trunk/gcc/df-scan.c:680
#7  0x08331deb in rest_of_handle_ira () at
../../../gcc.gnu.org/trunk/gcc/ira.c:3746
#8  0x08397014 in execute_one_pass (pass=0x887bde0) at
../../../gcc.gnu.org/trunk/gcc/passes.c:1555
#9  0x0839730d in execute_pass_list (pass=0x887bde0) at
../../../gcc.gnu.org/trunk/gcc/passes.c:1610
#10 0x08397320 in execute_pass_list (pass=0x887c0e0) at
../../../gcc.gnu.org/trunk/gcc/passes.c:1611
#11 0x08478bca in tree_rest_of_compilation (fndecl=0xb7e06000) at
../../../gcc.gnu.org/trunk/gcc/tree-optimize.c:422
#12 0x08618ef6 in cgraph_expand_function (node=0xb7dfd264) at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1575
#13 0x0861bf89 in cgraph_optimize () at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1634
#14 0x0861c48d in cgraph_finalize_compilation_unit () at
../../../gcc.gnu.org/trunk/gcc/cgraphunit.c:1095
#15 0x080b6720 in c_write_global_declarations () at
../../../gcc.gnu.org/trunk/gcc/c-decl.c:9879
#16 0x08414eee in toplev_main (argc=19, argv=0xbfffe854) at
../../../gcc.gnu.org/trunk/gcc/toplev.c:591
#17 0x08152572 in main (argc=-1209708932, argv=0x0) at
../../../gcc.gnu.org/trunk/gcc/main.c:36
(gdb) frame 1
#1  0x081e275b in df_ref_record (cl=DF_REF_REGULAR,
collection_rec=0xbfffe46c, reg=0xb7c67ae0, loc=0xb7e57c44,
bb=0xb7ddfc80, insn_info=0x890aacc, ref_type=DF_REF_REG_DEF,
ref_flags=32800) at ../../../gcc.gnu.org/trunk/gcc/df-scan.c:2841
(gdb) p reg
$1 = (rtx) 0xb7c67ae0
(gdb) pr
(mem/c:HI (plus:HI (reg/f:HI 32 __SP_L__)
        (const_int 1 [0x1])) [8 %sfp+1 S2 A8])
(gdb) p *current_pass
$2 = {type = RTL_PASS, name = 0x87ee735 "ira", gate = 0x832d2f0
<gate_ira>, execute = 0x83318a0 <rest_of_handle_ira>, sub = 0x0, next
= 0x887c120, static_pass_number = 194, tv_id = TV_NONE,
properties_required = 0, properties_provided = 0, properties_destroyed
= 0, todo_flags_start = 524288, todo_flags_finish = 3}
(gdb)

However, df_scan.c reads

static void
df_ref_record (enum df_ref_class cl,
	       struct df_collection_rec *collection_rec,
               rtx reg, rtx *loc,
	       basic_block bb, struct df_insn_info *insn_info,
	       enum df_ref_type ref_type,
	       int ref_flags)
{
  unsigned int regno;

  gcc_checking_assert (REG_P (reg) || GET_CODE (reg) == SUBREG);

  ...

Johann


[-- Attachment #2: strtod-i.c --]
[-- Type: text/x-csrc, Size: 14694 bytes --]













typedef int int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));

typedef int int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));

typedef int16_t intptr_t;




typedef uint16_t uintptr_t;

typedef int8_t int_least8_t;




typedef uint8_t uint_least8_t;




typedef int16_t int_least16_t;




typedef uint16_t uint_least16_t;




typedef int32_t int_least32_t;




typedef uint32_t uint_least32_t;







typedef int64_t int_least64_t;






typedef uint64_t uint_least64_t;

typedef int8_t int_fast8_t;




typedef uint8_t uint_fast8_t;




typedef int16_t int_fast16_t;




typedef uint16_t uint_fast16_t;




typedef int32_t int_fast32_t;




typedef uint32_t uint_fast32_t;







typedef int64_t int_fast64_t;






typedef uint64_t uint_fast64_t;

typedef int64_t intmax_t;




typedef uint64_t uintmax_t;


typedef int32_t int_farptr_t;



typedef uint32_t uint_farptr_t;



typedef unsigned int size_t;
























typedef void prog_void __attribute__((__progmem__));
typedef char prog_char __attribute__((__progmem__));
typedef unsigned char prog_uchar __attribute__((__progmem__));

typedef int8_t prog_int8_t __attribute__((__progmem__));
typedef uint8_t prog_uint8_t __attribute__((__progmem__));
typedef int16_t prog_int16_t __attribute__((__progmem__));
typedef uint16_t prog_uint16_t __attribute__((__progmem__));
typedef int32_t prog_int32_t __attribute__((__progmem__));
typedef uint32_t prog_uint32_t __attribute__((__progmem__));

typedef int64_t prog_int64_t __attribute__((__progmem__));
typedef uint64_t prog_uint64_t __attribute__((__progmem__));

extern const prog_void * memchr_P(const prog_void *, int __val, size_t __len) __attribute__((__const__));
extern int memcmp_P(const void *, const prog_void *, size_t) __attribute__((__pure__));
extern void *memccpy_P(void *, const prog_void *, int __val, size_t);
extern void *memcpy_P(void *, const prog_void *, size_t);
extern void *memmem_P(const void *, size_t, const prog_void *, size_t) __attribute__((__pure__));
extern const prog_void * memrchr_P(const prog_void *, int __val, size_t __len) __attribute__((__const__));
extern char *strcat_P(char *, const prog_char *);
extern const prog_char * strchr_P(const prog_char *, int __val) __attribute__((__const__));
extern const prog_char * strchrnul_P(const prog_char *, int __val) __attribute__((__const__));
extern int strcmp_P(const char *, const prog_char *) __attribute__((__pure__));
extern char *strcpy_P(char *, const prog_char *);
extern int strcasecmp_P(const char *, const prog_char *) __attribute__((__pure__));
extern char *strcasestr_P(const char *, const prog_char *) __attribute__((__pure__));
extern size_t strcspn_P(const char *__s, const prog_char * __reject) __attribute__((__pure__));
extern size_t strlcat_P (char *, const prog_char *, size_t );
extern size_t strlcpy_P (char *, const prog_char *, size_t );
extern size_t strlen_P(const prog_char *) __attribute__((__const__));
extern size_t strnlen_P(const prog_char *, size_t) __attribute__((__const__));
extern int strncmp_P(const char *, const prog_char *, size_t) __attribute__((__pure__));
extern int strncasecmp_P(const char *, const prog_char *, size_t) __attribute__((__pure__));
extern char *strncat_P(char *, const prog_char *, size_t);
extern char *strncpy_P(char *, const prog_char *, size_t);
extern char *strpbrk_P(const char *__s, const prog_char * __accept) __attribute__((__pure__));
extern const prog_char * strrchr_P(const prog_char *, int __val) __attribute__((__const__));
extern char *strsep_P(char **__sp, const prog_char * __delim);
extern size_t strspn_P(const char *__s, const prog_char * __accept) __attribute__((__pure__));
extern char *strstr_P(const char *, const prog_char *) __attribute__((__pure__));
extern char *strtok_P(char *__s, const prog_char * __delim);
extern char *strtok_rP(char *__s, const prog_char * __delim, char **__last);

extern size_t strlen_PF (uint_farptr_t src) __attribute__((__const__));
extern size_t strnlen_PF (uint_farptr_t src, size_t len) __attribute__((__const__));
extern void *memcpy_PF (void *dest, uint_farptr_t src, size_t len);
extern char *strcpy_PF (char *dest, uint_farptr_t src);
extern char *strncpy_PF (char *dest, uint_farptr_t src, size_t len);
extern char *strcat_PF (char *dest, uint_farptr_t src);
extern size_t strlcat_PF (char *dst, uint_farptr_t src, size_t siz);
extern char *strncat_PF (char *dest, uint_farptr_t src, size_t len);
extern int strcmp_PF (const char *s1, uint_farptr_t s2) __attribute__((__pure__));
extern int strncmp_PF (const char *s1, uint_farptr_t s2, size_t n) __attribute__((__pure__));
extern int strcasecmp_PF (const char *s1, uint_farptr_t s2) __attribute__((__pure__));
extern int strncasecmp_PF (const char *s1, uint_farptr_t s2, size_t n) __attribute__((__pure__));
extern char *strstr_PF (const char *s1, uint_farptr_t s2);
extern size_t strlcpy_PF (char *dst, uint_farptr_t src, size_t siz);
extern int memcmp_PF(const void *, uint_farptr_t, size_t) __attribute__((__pure__));



extern int isalnum(int __c) __attribute__((__const__));






extern int isalpha(int __c) __attribute__((__const__));






extern int isascii(int __c) __attribute__((__const__));





extern int isblank(int __c) __attribute__((__const__));





extern int iscntrl(int __c) __attribute__((__const__));





extern int isdigit(int __c) __attribute__((__const__));





extern int isgraph(int __c) __attribute__((__const__));





extern int islower(int __c) __attribute__((__const__));





extern int isprint(int __c) __attribute__((__const__));






extern int ispunct(int __c) __attribute__((__const__));







extern int isspace(int __c) __attribute__((__const__));





extern int isupper(int __c) __attribute__((__const__));






extern int isxdigit(int __c) __attribute__((__const__));

extern int toascii(int __c) __attribute__((__const__));





extern int tolower(int __c) __attribute__((__const__));





extern int toupper(int __c) __attribute__((__const__));



extern int errno;





extern double cos(double __x) __attribute__((__const__));





extern double sin(double __x) __attribute__((__const__));





extern double tan(double __x) __attribute__((__const__));






extern double fabs(double __x) __attribute__((__const__));






extern double fmod(double __x, double __y) __attribute__((__const__));

extern double modf(double __x, double *__iptr);



extern float modff (float __x, float *__iptr);




extern double sqrt(double __x) __attribute__((__const__));





extern double cbrt(double __x) __attribute__((__const__));

extern double hypot (double __x, double __y) __attribute__((__const__));







extern double square(double __x) __attribute__((__const__));






extern double floor(double __x) __attribute__((__const__));






extern double ceil(double __x) __attribute__((__const__));

extern double frexp(double __x, int *__pexp);







extern double ldexp(double __x, int __exp) __attribute__((__const__));





extern double exp(double __x) __attribute__((__const__));





extern double cosh(double __x) __attribute__((__const__));





extern double sinh(double __x) __attribute__((__const__));





extern double tanh(double __x) __attribute__((__const__));







extern double acos(double __x) __attribute__((__const__));







extern double asin(double __x) __attribute__((__const__));






extern double atan(double __x) __attribute__((__const__));

extern double atan2(double __y, double __x) __attribute__((__const__));





extern double log(double __x) __attribute__((__const__));





extern double log10(double __x) __attribute__((__const__));





extern double pow(double __x, double __y) __attribute__((__const__));






extern int isnan(double __x) __attribute__((__const__));

extern int isinf(double __x) __attribute__((__const__));






__attribute__((__const__)) static inline int isfinite (double __x)
{
    unsigned char __exp;
    __asm__ (
 "mov	%0, %C1		\n\t"
 "lsl	%0		\n\t"
 "mov	%0, %D1		\n\t"
 "rol	%0		"
 : "=r" (__exp)
 : "r" (__x) );
    return __exp != 0xff;
}






__attribute__((__const__)) static inline double copysign (double __x, double __y)
{
    __asm__ (
 "bst	%D2, 7	\n\t"
 "bld	%D0, 7	"
 : "=r" (__x)
 : "0" (__x), "r" (__y) );
    return __x;
}

extern int signbit (double __x) __attribute__((__const__));






extern double fdim (double __x, double __y) __attribute__((__const__));

extern double fma (double __x, double __y, double __z) __attribute__((__const__));







extern double fmax (double __x, double __y) __attribute__((__const__));







extern double fmin (double __x, double __y) __attribute__((__const__));






extern double trunc (double __x) __attribute__((__const__));

extern double round (double __x) __attribute__((__const__));

extern long lround (double __x) __attribute__((__const__));

extern long lrint (double __x) __attribute__((__const__));





typedef int wchar_t;


typedef struct {
 int quot;
 int rem;
} div_t;


typedef struct {
 long quot;
 long rem;
} ldiv_t;


typedef int (*__compar_fn_t)(const void *, const void *);

extern void abort(void) __attribute__((__noreturn__));




extern int abs(int __i) __attribute__((__const__));

extern long labs(long __i) __attribute__((__const__));

extern void *bsearch(const void *__key, const void *__base, size_t __nmemb,
       size_t __size, int (*__compar)(const void *, const void *));







extern div_t div(int __num, int __denom) __asm__("__divmodhi4") __attribute__((__const__));





extern ldiv_t ldiv(long __num, long __denom) __asm__("__divmodsi4") __attribute__((__const__));

extern void qsort(void *__base, size_t __nmemb, size_t __size,
    __compar_fn_t __compar);

extern long strtol(const char *__nptr, char **__endptr, int __base);

extern unsigned long strtoul(const char *__nptr, char **__endptr, int __base);

extern long atol(const char *__s) __attribute__((__pure__));

extern int atoi(const char *__s) __attribute__((__pure__));

extern void exit(int __status) __attribute__((__noreturn__));

extern void *malloc(size_t __size) __attribute__((__malloc__));






extern void free(void *__ptr);




extern size_t __malloc_margin;




extern char *__malloc_heap_start;




extern char *__malloc_heap_end;






extern void *calloc(size_t __nele, size_t __size) __attribute__((__malloc__));

extern void *realloc(void *__ptr, size_t __size) __attribute__((__malloc__));

extern double strtod(const char *__nptr, char **__endptr);

extern double atof(const char *__nptr);

extern int rand(void);



extern void srand(unsigned int __seed);






extern int rand_r(unsigned long *__ctx);

extern char *itoa(int __val, char *__s, int __radix);

extern char *ltoa(long int __val, char *__s, int __radix);

extern char *utoa(unsigned int __val, char *__s, int __radix);

extern char *ultoa(unsigned long int __val, char *__s, int __radix);

extern long random(void);




extern void srandom(unsigned long __seed);







extern long random_r(unsigned long *__ctx);

extern char *dtostre(double __val, char *__s, unsigned char __prec,
       unsigned char __flags);

extern char *dtostrf(double __val, signed char __width,
                     unsigned char __prec, char *__s);







extern double __floatunsisf (unsigned long);

__attribute__((__progmem__)) static const float pwr_p10 [6] = {
    1e+1, 1e+2, 1e+4, 1e+8, 1e+16, 1e+32
};
__attribute__((__progmem__)) static const float pwr_m10 [6] = {
    1e-1, 1e-2, 1e-4, 1e-8, 1e-16, 1e-32
};


__attribute__((__progmem__)) static const char pstr_inf[] = {'I','N','F'};
__attribute__((__progmem__)) static const char pstr_inity[] = {'I','N','I','T','Y'};
__attribute__((__progmem__)) static const char pstr_nan[] = {'N','A','N'};

__attribute__ ((section (".text.avr-libc")))
double
strtod (const char * nptr, char ** endptr)
{
    union {
 unsigned long u32;
 float flt;
    } x;
    unsigned char c;
    int exp;

    unsigned char flag;






    if (endptr)
 *endptr = (char *)nptr;

    do {
 c = *nptr++;
    } while (isspace (c));

    flag = 0;
    if (c == '-') {
 flag = 0x01;
 c = *nptr++;
    } else if (c == '+') {
 c = *nptr++;
    }

    if (!strncasecmp_P (nptr - 1, pstr_inf, 3)) {
 nptr += 2;
 if (!strncasecmp_P (nptr, pstr_inity, 5))
     nptr += 5;
 if (endptr)
     *endptr = (char *)nptr;
 return flag & 0x01 ? -__builtin_inf() : +__builtin_inf();
    }



    if (!strncasecmp_P (nptr - 1, pstr_nan, 3)) {
 if (endptr)
     *endptr = (char *)nptr + 2;
 return __builtin_nan("");
    }

    x.u32 = 0;
    exp = 0;
    while (1) {

 c -= '0';

 if (c <= 9) {
     flag |= 0x02;
     if (flag & 0x04) {
  if (!(flag & 0x08))
      exp += 1;
     } else {
  if (flag & 0x08)
      exp -= 1;

  x.u32 = (((x.u32 << 2) + x.u32) << 1) + c;
  if (x.u32 >= ((2147483647L * 2UL + 1UL) - 9) / 10)
      flag |= 0x04;
     }

 } else if (c == (('.'-'0') & 0xff) && !(flag & 0x08)) {
     flag |= 0x08;
 } else {
     break;
 }
 c = *nptr++;
    }

    if (c == (('e'-'0') & 0xff) || c == (('E'-'0') & 0xff))
    {
 int i;
 c = *nptr++;
 i = 2;
 if (c == '-') {
     flag |= 0x10;
     c = *nptr++;
 } else if (c == '+') {
     c = *nptr++;
 } else {
     i = 1;
 }
 c -= '0';
 if (c > 9) {
     nptr -= i;
 } else {
     i = 0;
     do {
  if (i < 3200)
      i = (((i << 2) + i) << 1) + c;
  c = *nptr++ - '0';
     } while (c <= 9);
     if (flag & 0x10)
  i = -i;
     exp += i;
 }
    }

    if ((flag & 0x02) && endptr)
 *endptr = (char *)nptr - 1;

    x.flt = __floatunsisf (x.u32);
    if ((flag & 0x01) && (flag & 0x02))
 x.flt = -x.flt;

    if (x.flt != 0) {
 int pwr;
 if (exp < 0) {
     nptr = (void *)(pwr_m10 + 5);
     exp = -exp;
 } else {
     nptr = (void *)(pwr_p10 + 5);
 }
 for (pwr = 32; pwr; pwr >>= 1) {
     for (; exp >= pwr; exp -= pwr) {
  union {
      unsigned long u32;
      float flt;
  } y;
  y.u32 = (__extension__({ uint16_t __addr16 = (uint16_t)((uint16_t)((float *)nptr)); uint32_t __result; __asm__ ( "lpm" "\n\t" "mov %A0, r0" "\n\t" "adiw r30, 1" "\n\t" "lpm" "\n\t" "mov %B0, r0" "\n\t" "adiw r30, 1" "\n\t" "lpm" "\n\t" "mov %C0, r0" "\n\t" "adiw r30, 1" "\n\t" "lpm" "\n\t" "mov %D0, r0" "\n\t" : "=r" (__result), "=z" (__addr16) : "1" (__addr16) : "r0" ); __result; }));
  x.flt *= y.flt;
     }
     nptr -= sizeof(float);
 }
 if (!isfinite(x.flt) || x.flt == 0)
     errno = 34;
    }

    return x.flt;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-01 10:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-01 10:49 Assertion failure during IRA (df_scan.c) Georg-Johann Lay

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