g++ compiling code that is wrong.

Joel Jansson biitar@home.se
Wed Apr 27 20:45:00 GMT 2005


I dont know if I am to write here, but I think I found a bug that I know 
is not related to my hardware or my system. Problem is that I don't know 
how to report it or if it allready been reported(Kind of hard to search 
for a bug when you dont know how to describe it.).

Backstory : I am a bit of a newbie on C++ and  was doing a 
schoolassigment where I was to make a dynamic array. I didn't do it 
right but the code compile(and work on gentoo, didn't work on windowsXP) 

Instead of using new and delete[] when making the array, I wrote a code 
that was something like this :

int b;
char a[b];
       cout << "bla bla bla";

The code compile both on gentoo linux(gcc 3.3.5 gcc 3.4.3) and 
windowsXP(Minigw 3.2.0-rc3) and on my friends computer under gcc(I 
belive Cygwin, dont know which version). I haven't tried it on newer 
versions, so I don't know if you already fixed it.

According to the friend(who work as a c++ programer doing apps and stuff 
on linuxsystems) and the teacher, this code is shouldn't be able to 
compile at all(Which it didn't under MS visual studio).

I was compiling with no options, just g++ but now I saw there was a 
-pedantic options and I tried it which return error.

Hope I didn't waste your time with a bug allready reported, but I 
thought it would be better to report it just incase.


More information about the Gcc-bugs mailing list