Bug 25677 - [4.2 regression] testsuite failure:gcc.c-torture/execute/960802-1.c -O1 and -O2
Summary: [4.2 regression] testsuite failure:gcc.c-torture/execute/960802-1.c -O1 and -O2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Paolo Bonzini
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2006-01-05 02:40 UTC by Hans-Peter Nilsson
Modified: 2006-01-16 18:21 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: cris-axis-elf, cris-axis-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-05 15:08:50


Attachments
patch to try (934 bytes, patch)
2006-01-05 16:59 UTC, Paolo Bonzini
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Nilsson 2006-01-05 02:40:50 UTC
Last known to work with: "Mon Dec 12 22:04:54 UTC 2005 (revision 108426M)".
Known to fail with: "Mon Jan  2 13:08:54 UTC 2006 (revision 109236M)":

Running /home/hp/combined/combined/gcc/testsuite/gcc.c-torture/execute/execute.exp ...
FAIL: gcc.c-torture/execute/960802-1.c execution,  -O1
FAIL: gcc.c-torture/execute/960802-1.c execution,  -O2

With the message in gcc.log showing an abort call.
The assembly code acts as if the line
 v = (v & 0x00ffffff) | (o & 0xff000000);
was
 v = o;
(actually there are no instructions which is the same as passing on the
return value from the previous call as the first parameter in this ABI.)
Looking at the RTL dumps, it seems combine is at fault; all the bit fiddling
is gone.
As there has been changes in this area after Jan 2, I expect it to have been
fixed but it seemed proper to add this PR before updating.
I assign it to myself until I've checked whether it remains, so no-one is
tempted to do a wild goose chase.
Comment 1 Hans-Peter Nilsson 2006-01-05 15:08:50 UTC
It's still there LAST_UPDATED "Thu Jan  5 03:26:35 UTC 2006 (revision 109371M)",
so I unassign myself, at least temporarily.
Bonzini, a comment?
Comment 2 Paolo Bonzini 2006-01-05 15:10:23 UTC
If it's still there, assign it to me.
Comment 3 Hans-Peter Nilsson 2006-01-05 15:51:11 UTC
As offered in comment #2. Thanks!
Comment 4 Paolo Bonzini 2006-01-05 16:59:08 UTC
Combine does not try to combine across a call.  But it does not invalidate equivalences and, in this case, it tries to replace v (the result of a function call) with the return value register... even though in the meanwhile a different function call has clobbered it.

H-P can you please run an assembly language comparison on this patch, to check that it does not pessimize anything?

I think the bug is latent in other branches as well.
Comment 5 Paolo Bonzini 2006-01-05 16:59:42 UTC
Created attachment 10585 [details]
patch to try
Comment 6 Hans-Peter Nilsson 2006-01-07 00:02:09 UTC
I built and checked cross from i686-pc-linux-gnu to cris-axis-linux-gnu with this
patch, and built CSiBE-2.1.1 at -O0, -O1, -O2 (note 1) and -O3 compile-time
tests and -Os compile-time and size tests, with just the two expected
differences in the generated code (using the previously posted unrandomization
and asm-wrapper patches).
Thanks!

(note 1: fails to compile -O2: invalid assembly code is generated for
linux-2.4.23-pre3-testplatform/net/ipv4/tcp_input.c at -O2 with and without
the patch due to a different bug)
Comment 7 Paolo Bonzini 2006-01-16 18:21:21 UTC
Patch committed