This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 4.1.2, some testcases fail when built with optimizations


I analyzed the problem and it is clear that it is a bug in the
optimizer. 

In scalbn() (packages/language/c/libm/current/src/double/portable-api/s_scalbn.c:109)
the code reads:
	{CYG_LIBM_HI(x) = (hx&0x800fffff)|(k<<20); return x;}

The generated code looks like this:
800485a4:       e3cc347f        bic     r3, ip, #2130706432     ; 0x7f000000
800485a8:       e3c3360f        bic     r3, r3, #15728640       ; 0xf00000
800485ac:       e89d0003        ldmia   sp, {r0, r1}
800485b0:       e1833a02        orr     r3, r3, r2, lsl #20
800485b4:       e5853000        str     r3, [r5]
800485b8:       eaffffe6        b       80048558 <scalbn+0x78>

Whats happening here is that the return value is read from memory before
it is calculated and stored there. Obviously the ldmia belongs after the str.
After fixing the instruction order in the compiled binary it even works.

On Mon, Jun 18, 2007 at 07:20:42AM -0600, Gary Thomas wrote:
> Can you try something newer?  4.2 is now out.

This is what I will try next.


-- 
%SYSTEM-F-ANARCHISM, The operating system has been overthrown

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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