On Fri, Jan 29, 2016 at 02:09:25AM +0100, Bernd Schmidt wrote: > I'm on the fence; I do think the original problem is an issue we should fix, > but I'm also not terribly happy with the implementation we have right now.
The fact that it has been only reported from generated testcases only means we are lucky nobody encountered it yet in real-world programs. Plus, we need to be thankful to people working on those generators that keep reporting GCC bugs, they significantly improve the compiler. > Besides the issues already mentioned, doesn't it kind of assume these > offsets are constant (which they definitely aren't, consider arg pushes for > example)? Sure, for some registers the offsets aren't constant. In some cases we e.g. have REG_ARGS_SIZE notes, but in other cases don't and don't have anything else that would help us understand the difference between current sp value and one at the end of the prologue or so. > I think a better approach might be to just mark accesses at known locations > in the frame, or arg pushes, as MEM_NOTRAP_P, and consider accesses with > non-constant or calculated offsets as potentially trapping. I don't see how that would work generally. Sure, if there is e.g. a constant offset array access, it could be checked easily, but if there is variable offset array access, that is at some point later on changed into a constant offset access, you'd need to be conservative, unless you can prove it is in range. Or perhaps we could also use some other flag (or turn it into __builtin_trap or __builtin_unreachable or whatever) to mark MEMs that are always invalid if executed. Jakub