This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Debugging help; how to debug something wrong in the rtl withoptimisation

(Re bug Optimization/1931)
  As reported in the bug reference above I'm having problems crossing from

The problem appears to be a floating point comparision with 0 is turning
into a comparision with -1.08709117743770659141e-1257 - I guess thats
close - but the assembler really doesn't like that.

So time to ask for some intermediate dumps; given the code:

typedef float DFtype __attribute__ ((mode (DF)));

crossbug (DFtype a)
  int v=0;
  if (a < 0)
  return v;

in the .00.rtl file is :

(insn 12 10 14 (set (reg:DF 31)
        (const_double:DF (cc0) -5787213827046178816 [0xafafafafafaf0000]
-5787213827046133841 [0xafafafafafafafaf])) -1 (nil)
    (expr_list:REG_EQUAL (const_double:DF (cc0) -5787213827046178816
[0xafafafafafaf0000] -5787213827046133841 [0xafafafafafafafaf])

But that only lands in there with -O2 - so how do I find out what caused
that transformation? With -O1 we get:

(jump_insn 14 13 15 (set (pc)
        (if_then_else (lt (cc0)
                (const_int 0 [0x0]))
            (label_ref 17)
            (pc))) -1 (nil)

So I guess it is the transformation of the integer 0 into the double?

In the generated assembler we see:

|(insn:QI 14 44 15 (set (cc0)
|        (compare (reg:DF 16 %fp0)
|            (const_double:DF (cc0) -5787213827046178816
[0xafafafafafaf0000] -5787213827046133841 [0xafafafafafafafaf]))) 16
{*} (insn_list 44 (nil))
|    (expr_list:REG_DEAD (reg:DF 16 %fp0)
|        (nil)))
	fcmp.d #0r-1.08709117743770659141e-1257,%fp0	| 14

Suggestions on where to look for this would be welcome. dconst0 in
emit-rtl.c looks OK to me.

Is there any way to trace the RTL generation process to see where it
produces that?


 ---------------- Have a happy GNU millennium! ----------------------   
/ Dr. David Alan Gilbert      | Running GNU/Linux on Alpha, | Happy  \ 
\   gro.gilbert @ | 68K,MIPS,x86,ARM and SPARC  | In Hex /
 \ ___________________________|___   |_______/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]