c++ - Internal error: cgcod 2247
- Eduardo Nunes (31/31) Feb 14 2005 Hi,
- Ozaki (5/36) Feb 14 2005 I tried your code, and found out the optimization of hlobal common
Hi, I have found a compiler error: ---(bug.cpp)---------------------------------- #include "stdio.h" class A { const char *a; unsigned int b; public: A() {a=NULL; b=(unsigned int)(-1);} bool test(void) const {return b==(unsigned int)(-1);} void foo(void) {b = 1;} void bar(void) {printf("bar: %d\n",b);} }; class B { A a[2]; public: A &get(int i) {if(a[i].test())a[i].foo(); return a[i];} }; int main(void) { B b; b.get(0).bar(); return 0; } ----------------------------------------------- dmc -o+all bug.cpp Internal error: cgcod 2247 Compiler version is 8.42n (beta) Eduardo Nunes
Feb 14 2005
I tried your code, and found out the optimization of hlobal common subexpressions elimination (cse) and dead assignment elimination (da) cause the error. Disable anyone of two optimization mentioned (-o-cse or -o-cse) will solve the problem. Hope this can help Walter to find the bug more easily. In article <cur994$21m7$1 digitaldaemon.com>, Eduardo Nunes says...Hi, I have found a compiler error: ---(bug.cpp)---------------------------------- #include "stdio.h" class A { const char *a; unsigned int b; public: A() {a=NULL; b=(unsigned int)(-1);} bool test(void) const {return b==(unsigned int)(-1);} void foo(void) {b = 1;} void bar(void) {printf("bar: %d\n",b);} }; class B { A a[2]; public: A &get(int i) {if(a[i].test())a[i].foo(); return a[i];} }; int main(void) { B b; b.get(0).bar(); return 0; } ----------------------------------------------- dmc -o+all bug.cpp Internal error: cgcod 2247 Compiler version is 8.42n (beta) Eduardo Nunes
Feb 14 2005