------- Additional Comments From nathan at gcc dot gnu dot org 2004-11-03 14:40 ------- ug. This bug falls between a number of stools. 1) on ppc-64 ints are returned correctly sign extended to 64 bits 2) the tree-ssa optimizers are blind to parameter marshalling, so the necessary sign extension is added at the tree->rtl conversion 3) When combine runs, there is still one common exit block containing i_64 = contents_of_i i_32 = (int)i_64 result = sign_extend (i_32) As the 'contents_of_i' are initialized in different blocks, combine has no knowledge of its possible values. So, it doesn't know the truncation and extension is a nop. 4) The terminating bb gets duplicated by bbro right at the end of optimization. No subsequent cse stage runs after that.
If tree-ssa was made ABI aware, we'd be in much better shape. This is similar to 16802 but with bb-cloning to further expose the stupidity -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16797