Logo Search packages:      
Sourcecode: gcc-2.95 version File versions

bug-47065.c

/*
From: Tyson Dowd <trd@cs.mu.OZ.AU>
To: submit@bugs.debian.org
Subject: Bug#47065: gcc miscompiles label addresses with -O
Date: Sun, 10 Oct 1999 21:41:44 +1000

Package: gcc
Version: 1:2.95.1-2

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);
        }

Generated by  Doxygen 1.6.0   Back to index