On Tue, Jan 24, 2012 at 08:36:11AM +0100, Jakub Jelinek wrote: > If you relax the checking too much, don't you risk that something other than > the TOC register value is being added to the UNSPEC_TOCREL? Say, if you > have an 8byte object in .toc, and some loop body uses > ((char *) &object)[1 + iv]; > to access it, can't you end up with (r2 + 1), or (r2 + 1 + iv) being added > to UNSPEC_TOCREL? Certainly on i686 something like that happens and that > is why the delegitimization needs to be strict about the pic register
I don't think so. We only put addresses, int constants smaller than Pmode, and FP constants in .toc. Hmm, however with -mcmodel=medium we do have UNSPEC_TOCREL refering to other local objects so you may be correct. > I've checked in my patch already OK. I was worried that we might be losing debug info, but if you take a look you'll see that location list is quite bogus anyway. At least it looks that way to me.. -- Alan Modra Australia Development Lab, IBM