This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/6956: when the given code is compiled with optimization > 0, it fails
- From: spamjunk at stny dot rr dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 7 Jun 2002 14:38:43 -0000
- Subject: optimization/6956: when the given code is compiled with optimization > 0, it fails
- Reply-to: spamjunk at stny dot rr dot com
>Number: 6956
>Category: optimization
>Synopsis: when the given code is compiled with optimization > 0, it fails
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 07 07:45:59 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: spamjunk@stny.rr.com
>Release: unknown-1.0
>Organization:
>Environment:
dos/windows
>Description:
#include <cstdio>
using namespace std;
template<class T, int I>
struct A {
A() {}
typedef T array[I];
struct B {
array a;
};
static B X()
{
const B b = {{0, 0, 5}};
return b;
}
};
typedef A<int, 5> C;
int main()
{
printf("%d\n", C::X().a[2]);
return 0;
}
This code fails with optimization turned on. If b is made a static constant, it doesn't fail.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: