This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Source of Ada bootstrap failure on x86
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: rth at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 21 Jul 04 08:46:28 EDT
- Subject: Source of Ada bootstrap failure on x86
The miscompilation is in exp_ch4.adb:Expand_N_Not_In
Look at what happens to the return value of sinfo__etype.
The reason has to do with tail calls and /u.
Here's an excerpt from exp_ch4.adb.21.regmove:
(call_insn:HI 16 15 17 0 (set (reg:SI 0 ax)
(call (mem:QI (symbol_ref:SI ("sinfo__etype") [flags 0x41] <function_decl 0x4050115c sinfo__etype>) [0 S1 A8])
(const_int 4 [0x4]))) 499 {*call_value_0} (nil)
(nil)
(nil))
(insn:HI 17 16 19 0 (set (reg/v:SI 63 [ typ ])
(reg:SI 0 ax)) 36 {*movsi_1} (insn_list 16 (nil))
(expr_list:REG_DEAD (reg:SI 0 ax)
(nil)))
....
(insn:HI 28 27 29 0 (set (mem/i:SI (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4])) [0 S4 A32])
(reg:SI 59 [ T.1409 ])) 36 {*movsi_1} (insn_list 25 (nil))
(expr_list:REG_DEAD (reg:SI 59 [ T.1409 ])
(nil)))
...
(insn:HI 42 40 43 0 (set (mem/u/i:SI (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4])) [0 S4 A32])
(reg/v:SI 63 [ typ ])) 36 {*movsi_1} (insn_list 17 (nil))
(expr_list:REG_DEAD (reg/v:SI 63 [ typ ])
(nil)))
(insn:HI 43 42 44 0 (set (mem/u/i:SI (reg/f:SI 7 sp) [0 S4 A32])
(reg/v/u:SI 64 [ n ])) 36 {*movsi_1} (nil)
(expr_list:REG_DEAD (reg/v/u:SI 64 [ n ])
(nil)))
(call_insn:HI 44 43 45 0 (call (mem:QI (symbol_ref:SI ("sem_res__analyze_and_resolve__2") [flags 0x41] <function_decl 0x40505e0c sem_res__analyze_and_resolve__2>) [0 S1 A8])
(const_int 8 [0x8])) 363 {*call_0} (nil)
(nil)
(nil))
Note that insn 27 sets 4(%esp) without /u while insn 42 sets it with /u.
These memrefs don't conflict and what ends up happening is that
insn 17 gets a REG_EQUIV note for 4(%exp).
This fixed by the following:
*** expr.c 20 Jul 2004 09:57:00 -0000 1.686
--- expr.c 21 Jul 2004 12:09:33 -0000
*************** emit_push_insn (rtx x, enum machine_mode
*** 3362,3367 ****
outgoing arguments and we cannot allow reordering of reads
from function arguments with stores to outgoing arguments
! of sibling calls. */
set_mem_alias_set (dest, 0);
}
--- 3362,3371 ----
outgoing arguments and we cannot allow reordering of reads
from function arguments with stores to outgoing arguments
! of sibling calls. Likewise, we can't allow this to be
! marked as unchanging.
!
! ??? So what is the call above doing? */
set_mem_alias_set (dest, 0);
+ RTX_UNCHANGING_P (dest) = 0;
}
But I'm thinking it's best simply to remove the call to set_mem_attributes
here (with appropriate comment, of course). What do you think?
I'm going to go back to x86_64, put in the kludge to get rid of the
variable-size issue, and see how ACATS stands: it was 154 failures yesterday.