Strange warning (variable might be clobbered by `longjmp' or

Jim Wilson wilson@chestnut.cygnus.com
Tue Sep 2 11:50:00 GMT 1997


I understand the importance of the EH support, however, I fear that there
are serious flaws with the current code which can not be fixed quickly enough
to avoid impacting our planned for initial release.

>From just looking at the RTL, and without trying to understand in detail what
the EH code is doing, I have seen the following problems:
1) There is no indication that control can flow from function calls to the
   code that catches exceptions.  This needs to be handled similarly to how
   nonlocal gotos from nested functions work.  Since there is already code
   to do this, this should be easy to fix.
2) There are indirect jumps (computed gotos) in the EH RTL.  I do not know
   why these are present, however, because they are present, flow must make
   worst case assumptions that these indirect jumps can branch to any label
   in the function whose address is taken.  The setjmp handlers must take
   the address of a label, and hence flow assumes that this indirect jump
   can reach any handler.  This results in a flow graph which is not
   particularly useful, because it contains too many paths which are not
   physically possible.
3) The builtin setjmp/longjmp RTL sends both execution paths to a conditional
   branch, which then tests a pseudo which has been either set to zero or to
   one.  This will branch to the catch routine if this was a longjmp, or
   fall through to the normal code if this was a setjmp.  Since flow does not
   keep track of data values, it can not know this distinction, so it can only
   see that it is possible for the setjmp path to reach both the catch routine
   and the normal code, and likewise for the longjmp.

While looking at flow, I noticed another problem:
4) There is code in flow which handles the case of basic blocks which are
   known to be reachable, but it is unknown how they are reached.  This code
   fixed the problem by adding a bogus execution path from the previous block.
   It should instead abort.

Jim



More information about the Gcc mailing list