This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

gcc.c-torture/unsorted/pass.c: what is it supposed to test?


I'm running into a failure on x86-64 when enabling the more aggressive
tailcall elimination predicates.  The test has:

---------------------------------------------------------------------------
int
foo (a, b, c)
{
  return a + b + c;
}

int
bar ()
{
  int q, w, e, r, t, y;

  return foo ((int) & q, q, w, e, q, (int) &w);
}
---------------------------------------------------------------------------

which at first sight doesn't strike me as particularly valid nor
useful.  What is it supposed to test?  Compiler endurance against
invalid code?

What is happening here is that the aliasing code is not marking 'w' nor
'q' as call-clobbered because their addresses are casted to int, and so
no valid pointer holds their address.  So, we mark the call to foo as a
tail call and then fail later in the back end with:

pass.c:13: error: unrecognizable insn:
(insn 40 13 15 0 (set (reg:SI 38 r9 [ w.1 ])
        (subreg:SI (plus:DI (subreg:DI (reg:SI 7 sp) 0)
                (const_int -4 [0xfffffffffffffffc])) 0)) -1 (nil)
    (nil))

Probably because 'int' is narrower than pointers on this host?

To fix this, I'll have the aliasing pass just mark variables whose
addresses are stashed in non-pointer objects as call-clobbered.  No
point wasting compile time chasing all non-pointers in the code.  If the
program is going to pull this kind of stunt, then I don't think we
should waste too much time optimizing it.

However, a more advanced analysis of the program would've noticed that
we don't actually call-clobber these two variables and would've failed
in the same way.

Thoughts?


Thanks.  Diego.


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