This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A bug in mark_constants () in varasm.c
- To: egcs at cygnus dot com
- Subject: A bug in mark_constants () in varasm.c
- From: hjl at lucon dot org (H.J. Lu)
- Date: Thu, 12 Mar 1998 20:03:02 -0800 (PST)
With egcs 980312 09:16am PST configured for linux/x86. I got the
undefined label ".LC1":
# cc -S -O2 -march=i686 -B/home/work/gnu/bin/egcs/gcc/ -dra r_tanh.c
# gcc -c r_tanh.s
# r_tanh.o
U .LC1
00000000 t gcc2_compiled.
00000000 T tanh
The problem is mark_constants () in varasm.c. Here is the comment in
mark_constants ():
/* Never search inside a CONST_DOUBLE, because CONST_DOUBLE_MEM may be
a MEM, but does not constitute a use of that MEM. This is particularly
important inside a nested function, because CONST_DOUBLE_MEM may be
a reference to a MEM in the parent's constant pool. See the comment
in force_const_mem. */
else if (GET_CODE (x) == CONST_DOUBLE)
return;
As you can see in r_tanh.c.stack, .LC1 is used. But mark_constants ()
doesn't search inside CONST_DOUBLE. That causes the problem. Could
someone please fix it?
Thanks.
--
H.J. Lu (hjl@gnu.org)
---r_tanh.c---
extern __inline double
__expm1 (double __x)
{
double __temp;
__temp = 1.0;
return __temp;
}
extern __inline double
__sgn1 (double __x)
{
return __x >= 0.0 ? 1.0 : -1.0;
}
double
tanh (double __x)
{
return __expm1 (__x) * __sgn1 (-__x);
}
----r_tanh.c.stack----
;; Function tanh
(note 2 0 5 "" NOTE_INSN_DELETED)
(note 5 2 6 "" NOTE_INSN_FUNCTION_BEG)
(note 6 5 8 "" NOTE_INSN_DELETED)
(note 8 6 9 "" NOTE_INSN_BLOCK_BEG)
(note 9 8 10 "" NOTE_INSN_BLOCK_BEG)
(note/i 10 9 12 "" NOTE_INSN_BLOCK_BEG)
(note/i 12 10 15 "" NOTE_INSN_DELETED)
(note/i 15 12 17 "" NOTE_INSN_BLOCK_END)
(note 17 15 21 "" NOTE_INSN_BLOCK_END)
(note 21 17 48 "" NOTE_INSN_BLOCK_BEG)
(note 48 21 52 "" NOTE_INSN_DELETED)
(note 52 48 54 "" NOTE_INSN_DELETED)
(note 54 52 36 "" NOTE_INSN_DELETED)
(note 36 54 39 "" NOTE_INSN_BLOCK_END)
(note 39 36 44 "" NOTE_INSN_DELETED)
(note 44 39 55 "" NOTE_INSN_BLOCK_END)
(note 55 44 57 "" NOTE_INSN_DELETED)
;; Insn is not within a basic block
(insn 57 55 59 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
(reg:SI 6 %ebp)) 49 {movsi-2} (nil)
(nil))
;; Insn is not within a basic block
(insn 59 57 56 (set (reg:SI 6 %ebp)
(reg:SI 7 %esp)) 53 {movsi+2} (insn_list 57 (nil))
(nil))
;; Start of basic block 0, registers live: 6 [bp]
(note 56 59 4 "" NOTE_INSN_PROLOGUE_END)
(insn:QI 4 56 18 (set (reg:DF 8 %st(0))
(mem:DF (plus:SI (reg:SI 6 %ebp)
(const_int 8)))) 76 {movdf_mem+1} (insn_list 59 (insn_list 57 (nil)))
(expr_list:REG_EQUIV (mem:DF (plus:SI (reg:SI 6 %ebp)
(const_int 8)))
(nil)))
(insn:QI 18 4 22 (set (reg:DF 8 %st(0))
(neg:DF (reg:DF 8 %st(0)))) 197 {negdf2} (insn_list 4 (nil))
(nil))
(insn/i:QI 22 18 65 (set (reg:DF 8 %st(0))
(const_double:DF (cc0) 0 0 0)) 76 {movdf_mem+1} (nil)
(expr_list:REG_EQUIV (const_double:DF (cc0) 0 0 0)
(nil)))
(insn:QI 65 22 49 (parallel[
(set (reg:DF 9 %st(1))
(reg:DF 8 %st(0)))
(set (reg:DF 8 %st(0))
(reg:DF 9 %st(1)))
] ) -1 (nil)
(nil))
(insn:QI 49 65 50 (parallel[
(set (cc0)
(compare (reg:DF 8 %st(0))
(reg:DF 9 %st(1))))
(clobber (reg:HI 0 %ax))
] ) 25 {cmpsf_cc_1-7} (insn_list 18 (insn_list 22 (nil)))
(expr_list:REG_DEAD (reg:DF 9 %st(1))
(expr_list:REG_DEAD (reg:DF 8 %st(0))
(expr_list:REG_UNUSED (reg:HI 0 %ax)
(nil)))))
(insn/s:QI 50 49 64 (set (reg:DF 8 %st(0))
(if_then_else:DF (ge (cc0)
(const_int 0))
(const_double:DF (cc0) 0 0 1073709056)
(const_double:DF (mem/u:DF (symbol_ref/u:SI ("*.LC1"))) 0 0 -1073774592))) 380 {movdfcc_1} (insn_list 22 (insn_list 18 (nil)))
(nil))
(note 64 50 61 "" NOTE_INSN_EPILOGUE_BEG)
(insn 61 64 62 (parallel[
(set (reg:SI 7 %esp)
(reg:SI 6 %ebp))
(clobber (reg:SI 6 %ebp))
] ) 343 {epilogue_set_stack_ptr} (insn_list:REG_DEP_OUTPUT 57 (insn_list 59 (insn_list:REG_DEP_ANTI 4 (nil))))
(nil))
(insn 62 61 40 (parallel[
(set (reg:SI 6 %ebp)
(mem:SI (reg:SI 7 %esp)))
(set (reg:SI 7 %esp)
(plus:SI (reg:SI 7 %esp)
(const_int 4)))
] ) 345 {pop} (insn_list 57 (insn_list 61 (nil)))
(nil))
(insn:QI 40 62 63 (use (reg/i:DF 8 %st(0))) -1 (insn_list 50 (nil))
(nil))
(jump_insn/s 63 40 60 (return) 334 {return_internal} (insn_list:REG_DEP_ANTI 62 (insn_list 50 (nil)))
(nil))
;; End of basic block 0
(barrier 60 63 0)