On 03/14/2016 03:56 AM, Richard Biener wrote:
Undefined? Most likely. But we still have to do something sensible. As
Jakub noted, a user could create the problematic code just as easily as
DCE/DSE, so IRA probably needs to be tolerant of this situation.
So it seems like you're suggesting we leave DCE/DSE alone (declaring this
usage undefined) and fix IRA to be tolerant, right?
Tolerant as in not crash? Yes.
Right. Tolerant as in not crash.
Using alloca to create/jump to code on the stack should work (we might
transform that into a decl though).
Given that executable stacks are a huge security hole, I'd be willing to go
out on a limb and declare that undefined as well. It's not as clear cut,
but that's the argument I'd make.
Well, I thought about somebody trying to build trampolines in a way exposed
to GCC.
Right or other dynamic, short-lived code fragments.
And yes, I realize that goes in opposition to what GCC has allowed for 20+
years. I still think it'd be the right thing to do.
Did we allow this? Not by design but rather by accident I suppose.
I don't think it was ever specifically allowed or disallowed; like many
of the old extensions, it was never crisply defined.
I can distinctly remember having to declare that taking the address of a
blob of code on the stack, then calling/jumping to it after the
containing function went out of scope as undefined. I think it was the
address of a trampoline, but I'm not entirely sure -- there's a small
chance it was user-created code. I only remember it because I was
surprised at how controversial it was to declare that as undefined :(
That most likely predates egcs, so the discussion is not likely in the
public archives. It may have been a private discussion between Kenner,
Jim, Doug and myself or some subset thereof.
jeff