This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: label question
- To: pb at nexus dot co dot uk
- Subject: Re: label question
- From: craig at jcb-sc dot com
- Date: 8 Apr 1999 14:02:22 -0000
- Cc: egcs at cygnus dot com
- Cc: craig at jcb-sc dot com
- References: <E10VCz8-00041b-00@fountain.nexus.co.uk>
>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?
I believe &&label is nothing more than a GCC extension -- that is,
I'm not aware of any other specifications GCC tries to implement
that specify &&label (though maybe C9X or something like that does;
I haven't kept track).
If it's specified to serve as a valid means to do non-local GOTO, then
the only situation where the compiler can conclude the label is
unreachable is one in which the compiler knows `bar' won't ever jump
to it.
If it's not specified to so serve, then I would think the compiler
can indeed delete the instructions following the label. Perhaps it
could even delete the label itself, making the pointer it passes to
`bar' undefined.
My reading of the documentation of this GCC feature supports the latter
interpretation: it is not intended to provide non-local GOTO.
(I looked it up in `extend.texi' in the EGCS sources.)
But, if some other specification says &&label is for non-local GOTO,
then, to implement that specification, GCC will need to be changed
-- not just its docs, but its handling of &&label as well.
tq vm, (burley)