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


[This topic was reported on the Debian bug tracking system. Please
 CC 47065@bugs.debian.org on replies.]


 The original posting was:

The following code example gives a different result when compiled
with and without -O.  The same code works fine under gcc 2.7.2.

        void *entry_foo_1;
        void *entry_bar_1;
        void *succip;
        int global;
        foo() {
                entry_foo_1 = && foo_1;
                return;
        foo_1:
                if (global != 42) exit(1);
                goto *entry_bar_1;
        }
        bar() {
                entry_bar_1 = && bar_1;
                return;
        bar_1:
                if (global != 42) exit(1);
                goto *succip;
        }
        main() {
                global = 42;
                foo();
                bar();
                succip = &&last;
                goto *entry_foo_1;
                exit(1);
        last:
                if (global != 42) exit(1);
                exit(0);
        }


Tyson Dowd writes:
 > On 19-Oct-1999, Matthias Klose <doko@cs.tu-berlin.de> wrote:
 > > I am not sure, but you may look at the gcc FAQ or at the gcc mailing
 > > list archive looking for "extern inline" functions; there was a thread 
 > > this spring.
 > 
 > 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.
 > 
 > This is a bit of a pity, since I don't think this is a particularly
 > useful optimization -- if you are taking the addresses of labels
 > you probably want to jump to the code.   Lots of high-level languages
 > that target gcc use this technique, and all of them are now going
 > to be screwed by the new versions of gcc coming out.
 > 
 > -- 
 >        Tyson Dowd           # 
 >                             #  Surreal humour isn't eveyone's cup of fur.
 >      trd@cs.mu.oz.au        # 
 > http://www.cs.mu.oz.au/~trd #


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