gcc-2.95.1 (Intel) & Stepanov Benchmark failures

H.J. Lu hjl@lucon.org
Mon Oct 18 06:55:00 GMT 1999


> 
>   In message < 19991018054303.B8F5E1B493@ocean.lucon.org >you write:
>   > Hi,
>   > 
>   > Please try
>   > 
>   > http://egcs.cygnus.com/ml/gcc-patches/1999-10/msg00320.html
> Why don't *YOU* submit the patch in a form that we can use so that we can
> properly evaluate it?
> 

I will give it one more try. Here is a small testcase. Please keep
in mind that the SVR4 ABI requires structures be returned in memory.
>From the stack rtl dump, we have

(insn 16 15 17 (set (mem/s:DF (reg/v:SI 0 %eax) 0)
        (reg:DF 8 %st(0))) 69 {movdf+1} (nil)
    (nil))

That puts the structure return in memory. However, it doesn't mark
(reg:DF 8 %st(0)) dead, which leaves a value in the register stack.
But the caller assumes the callee follows the SVR4 ABI which means
the register stack is empty upon return. As the result, you get
the register stack overflow/underflow later.

The problem is in stack_result () in reg-stack.c, which is supposed
to return a fp register RTX for the function return if the return
value is in fp register. However, it doesn't check the cases where
the ABI mandates the return in memory even if the return value can
fit in a fp register. With my patch which calls aggregate_value_p
to check the ABI for aggregates, I got

(insn 16 15 17 (set (mem/s:DF (reg/v:SI 0 %eax) 0)
        (reg:DF 8 %st(0))) 69 {movdf+1} (nil)
    (expr_list:REG_DEAD (reg:DF 8 %st(0))
        (nil)))

It puts the return in memory and marks the fp register dead. The
asm difference is

	fstpl (%eax)

vs.

	fstl (%eax)

That is what I got by reading the comments for stack_result (). It is
either the comment is wrong or my patch does the right thing.


-- 
H.J. Lu (hjl@gnu.org)
---
typedef struct {
     double epsilon;
} material_type;

material_type foo(void)
{
     material_type m;

     m.epsilon = 1.0;
     return m;
}


More information about the Gcc-bugs mailing list