This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: label question
- To: Philip Blundell <pb at nexus dot co dot uk>
- Subject: Re: label question
- From: Andreas Schwab <schwab at issan dot informatik dot uni-dortmund dot de>
- Date: 08 Apr 1999 14:39:30 +0200
- Cc: egcs at cygnus dot com
- References: <E10VCz8-00041b-00@fountain.nexus.co.uk>
Philip Blundell <pb@nexus.co.uk> writes:
|> Given code like this:
|>
|> foo()
|> {
|> bar(&&label);
|> return;
|>
|> label:
|> printf("Hello world\n");
|> }
|>
|> is it legal for the compiler to conclude that the label is unreachable and
|> delete the instructions following it, even though its address has been taken?
The docs say:
You can use this mechanism to jump to code in a different function.
If you do that, totally unpredictable things will happen. The best way
to avoid this is to store the label address only in automatic variables
and never pass it as an argument.
There is no way in your example to use the address of label in a defined
way (function bar surely cannot jump to it), so it is in fact unreachable.
--
Andreas Schwab "And now for something
schwab@issan.cs.uni-dortmund.de completely different"
schwab@gnu.org