Z
zl2k
hi, all
I got a wired bug when using gcc -O2. In short, I have something like
int a, b;
....
assert(a < b); //line 1
cout<<a<<" "<<b<<endl; //line 2
assert(a < b); //line 3
The program break on line 3. Why not break on line 1 since I did
nothing on line 2 but cout. However, if I put line 2 infront of line 1,
then the program will break on line 1.
Some experts suggests that this is due to the uninitilized variables
dangling arround. I check my constructor and quite sure all the
variables declared in the header file are initialized.
The above problem won't happen if not using the optimization switch. I
am using gcc 3.4.4. Thanks for your comments. How may I nail down the
bug?
zl2k
I got a wired bug when using gcc -O2. In short, I have something like
int a, b;
....
assert(a < b); //line 1
cout<<a<<" "<<b<<endl; //line 2
assert(a < b); //line 3
The program break on line 3. Why not break on line 1 since I did
nothing on line 2 but cout. However, if I put line 2 infront of line 1,
then the program will break on line 1.
Some experts suggests that this is due to the uninitilized variables
dangling arround. I check my constructor and quite sure all the
variables declared in the header file are initialized.
The above problem won't happen if not using the optimization switch. I
am using gcc 3.4.4. Thanks for your comments. How may I nail down the
bug?
zl2k