🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.memory
Article #1

A BUG in MSVC 1.5 ???

#1
From: lorbeyal
Date: Thu, 03 Aug 1995 05:17
78 lines
2855 bytes
I want to interduce to you something that might be a bug
in the msvc 1.5 compiler: The comiler don't give enouth room
for a big array, and step over the next vatiables in class.

I deliver this also to the c group, because it's basicly a
c problem.

This is my object definition:

#define pdVERTEX_ENTRY            10
#define pdNUM_VERTICES           512
#define pdMAX_VERTICES           300
#define pdSTOP_FLAG               -5
#define pdRE_EMPTY                -1

typedef MlV3d VArr[pdNUM_VERTICES];

typedef int VList[pdNUM_VERTICES][pdVERTEX_ENTRY];

class CVertexList : private CItemTag {
      VArr  vertexArray;	// list of vertices coordinates
      VList vertexList;		// list of nigbers vertices
      VList polygonList;	// list of polygons neigbers
      long maxVertices;		// max vertices to set in place
      long status;
		
ect...

This is a part of my initialization function:

long CVertexList::RestartVerlist ()
// restart the database
{
   RestartItemtag();
   for (int i=0; i<pdVERTEX_ENTRY; i++)
      for (int j=0; j<pdNUM_VERTICES; j++) {
         vertexList[j][i] = 0;
         if (maxVertices != pdMAX_VERTICES)   // debugging line #1
            Error();
         polygonList[j][i] = 0;
         if (maxVertices != pdMAX_VERTICES)   // debugging line #2
            Error();
      }

   if (maxVertices>=pdNUM_VERTICES)
      return 0;
	
ect...

Breakpoint are set on the two lines contains the Error function.
We shoudent actualy get into there...
The second breakpoint is activated and the data are set like this
 (taken from the watch window):

 maxVertices = 0
 i = 8
 j = 511
+&polygonList[j][i] = 0x3497:0x80FA
+&maxVertices = 0x3497:0x80FA
+&polygonList[0][0] = 0x3497:0x58FE
 status = -842150451
+&status = 0x3497:0x80FE


Note that if the array 'polygonList' starts at Adress 0x58fe then
the next variable shoud be set at least at 0x80fe, the next variable
('maxVertices') starts at adress 0x80fa, four bytes too erly.

I must say that this code was working well, After some changes, which done
in other places this bug appeared.

Is something wrong whith my programming? Is it a compiler bug, or what?
What can i do to deal whith this phenomena in the future?

---
Eyal Lorberboim
lorbeyal@netvision.net.il
Technical Details
Message-ID: <NEWTNews.1192.807427460.lorbeyal@Mercury.Netvision.net.il>
Path: arc1-ca.pugleaf.net!NetVision.net.il!usenet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!NetVision.net.il!usenet
From: lorbeyal@netvision.net.il
Newsgroups: comp.os.ms-windows.programmer.memory,comp.lang.c++,comp.lang.c
Subject: A BUG in MSVC 1.5 ???
Date: Wed, 02 Aug 95 22:17:17 PDT
Organization: NetVision USENET Site.
Message-ID: <NEWTNews.1192.807427460.lorbeyal@Mercury.Netvision.net.il>
NNTP-Posting-Host: ts23p8.netvision.net.il
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: lorbeyal@netvision.net.il
X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage