Bug 24812 - Optimizer creates infinite loop with -fno-strict-aliasing
Summary: Optimizer creates infinite loop with -fno-strict-aliasing
Status: RESOLVED DUPLICATE of bug 24804
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.4.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-11 20:51 UTC by Chris Newbold
Modified: 2005-11-11 20:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Newbold 2005-11-11 20:51:53 UTC
The following test program goes into an infinite loop when compiled with -O2 and -fno-strict-aliasing but works correctly if -fno-strict-aliasing is omitted.

$ g++-3.4 -g -O2 -fno-strict-aliasing -o loop loop.C

// loop.C
class DummyType
{
public:
    ~DummyType() { }
};

class Foo
{
public:
    Foo() : X0(0), X4(0) { }
    int X0, X1, X2, X3, X4;
};

int main(int, char**)
{
    {
        Foo f;
	DummyType d;
    }

    Foo f2;

    bool done(false);

    while (!done) {
	if (f2.X4 != 0) f2.X4 = 0;
	else done = true;;
    }

    return 0;
}

-----

Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)
Comment 1 Andrew Pinski 2005-11-11 20:56:56 UTC

*** This bug has been marked as a duplicate of 24804 ***