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]

Re: do we ever thread computed gotos?


On 10/26/2017 05:05 AM, Aldy Hernandez wrote:
> Howdy.
> 
> In the backwards threader we attempt to thread paths that lead to a
> basic block ending in either a GIMPLE_COND, GIMPLE_SWITCH, or a
> GIMPLE_GOTO.  The latter doesn't make much sense, since we only handle
> constants.  What does a goto to a constant mean?  Does that ever happen?
When we're able to thread a computed goto, we should be threading to an
ADDR_EXPR or LABEL_EXPR.  Threading to a constant just doesn't make sense.

However, we have to filter that case reasonably -- there's certainly a
test in the testsuite where a computed jump can be threaded to a
constant.  THe DOM threader aborted/faulted on that in the past.

So I wouldn't lose any sleep if we just didn't handle computed gotos in
the backwards threader and left it to DOM to catch the rare cases were
we can thread to a label/decl.

Jeff


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