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]

Re: label question


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


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