Loop bug

From: Voropaev S.G. (voropaev@inp.nsk.su)
Date: Thu Jul 24 1997 - 14:33:42 MEST


Hello,

I find bug in cint/root. But may be, this bug is fixed now in cint 5.13.17
("Loop compile internal error" bug). I have root with cint 5.13.16.

Bug:

file bad3.cpp
--------------------------------------------------------------------------------

#include <stdio.h>
class ResultInfo
{
public:
	int tmp;
};
class ResultArr	
{
public:
	ResultInfo *pArr;

	ResultArr()
	{	pArr = new ResultInfo[20]; };
	~ResultArr()
	{	delete [] pArr; };
	ResultInfo *GetAt(int i)
	{	return (pArr + i);	};
};

void bad3( )
{ 
	ResultArr resArr;
	ResultInfo *res;
	for(;1;)			// I try "while" first
	{
		res = resArr.GetAt(0);		// LINE 26
		break;
	}
	printf("%d\n",res->tmp);			// LINE 29
}
------------------------------------------------------------------------

in root interactive session:
root [0] .L bad3.cpp
root [1] bad3()
Error: Incorrect assignment to res  FILE:bad3.cpp LINE:26
Error: illegal pointer to class object res 0x0 224  FILE:bad3.cpp LINE:29
0

root may be crash with minor change in the code.
All works OK with lower optimization ( .O1).

I use root 1.01/07 on Windows NT.

					Voropaev S.G.



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:20 MET