This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Erroneous program misbehaves without warning


Consider the following program

vector<pair<int,int> > pfact(int n)
{
 cout << n;
}

void main(void)
{
 pfact(6);
 pfact(7);
}

It compiles *without warnings* with gcc-2.95.2 (mingw32; Mumit Khan's port),
but goes into an infinite loop after printing the six.

OK, it's a stupid program - the function fails to return a value, and the
value is then ignored by the caller - but it should at least print warnings,
and ideally fail to compile; compiling to something which hangs is not the
right idea at all.

{this is my first post to gcc@gcc.cygnus.com, which I read via the Web
interface; have I done something wrong?}

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]