Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by dcb
Fri, 16 Oct 1992 15:08
bug report
Author: dcb
Date: Fri, 16 Oct 1992 15:08
Date: Fri, 16 Oct 1992 15:08
71 lines
1465 bytes
1465 bytes
Hello there,
I have gcc 2.2.2 on sun 4 hardware, with SunOs 4.1.1
Given the following code
#include <stream.h>
static int c = 0;
struct S {
int loc;
S() {
loc = 0;
}
~S() {
++c;
}
};
int main() {
int i;
for (i = 0; i < 2; ++i) // note no {
for (S j; j.loc < 1; j.loc++) {
cout << c << "\n";
}
// note no }
cout << c << "\n";
return 0;
}
then I get output
0
0
0
But if I change the body of main to
int main() {
int i;
for (i = 0; i < 2; ++i) { // note {
for (S j; j.loc < 1; j.loc++) {
cout << c << "\n";
}
} // note }
cout << c << "\n";
return 0;
}
then I get
0
1
2
This bug happens wether -O is used or not.
If this isn't a bug, then I'd appreciate an ARM page number for the
reason why its different.
Regards
David C Binderman Dept US/ESI, Bau 60, SEL-Alcatel AG, Lorenz Strasse 10,
D-7000 Stuttgart 40, Germany dcb@us-es.sel.de Tel: +49 711 821 3841
Watch out for those dangerous fishy maultaschen !
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads