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: your Debian bug report #47065


On Thu, Nov 04, 1999 at 05:46:00PM +0100, Matthias Klose wrote:
>         void *entry_foo_1;
>         foo() {
>                 entry_foo_1 = && foo_1;
>                 return;
>         foo_1:
>                 if (global != 42) exit(1);
>                 goto *entry_bar_1;
>         }
>         main() {
>                 global = 42;
>                 foo();
>                 goto *entry_foo_1;
>                 exit(1);
>         last:
>                 if (global != 42) exit(1);
>                 exit(0);
>         }

This code is desparately wrong ...

>  > I have just looked this up and it appears the egcs maintainers have
>  > decided to take the approach that this is not legal code, and they
>  > are free to optimize away the code after the labels.

... and not merely for the reason of dead code removal.

Quoting from the gcc manual:

#    You cannot 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.



r~


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