LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting program from CVI 8.5 to 2013 fails during execution

I have a program that runs fine under CVI 8.5.1 but fails during exection under CVI 2013. It is an adaptation of some demo OpenGL code. The error occurs when running thru a second iteration of a loop that is supposed to be executing over an allocated area of memory that should be being treated as an array of values. The debugger view showed it properly but when accessing the second element in the array I get the error:

 

FATAL RUN-TIME ERROR:   "glm_avl.c", line 382, col 9, thread id 0x00002A60:   Dereference of out-of-bounds pointer: 1777632655 bytes (444408163 elements) before start of array.

 

If I change it so the second iteration doesn't change the pointer (stays pointing to the first element) under program control but I manually change it to the same address it would,  the program executes as I expect it to. Look around line 382 for the different ways I tried and failed to get it to work. I don't have a copy of 8.5.1 installed any more but the originally compiled version works.

Download All
0 Kudos
Message 1 of 5
(3,829 Views)

Hi ljstrick,

 

I am not sure that this is actually a CVI issue. You may just need to debug your code. Looking at the original, it does not indicate that model->materials[i] is out of bounds. On line 382, it could be that model->materials[i].diffuse[3] is out of bounds.

 

You said that this worked in a previous version of CVI. Was the code copied or reproduced in 2013? Is the example code an exact copy of OpenGL's code? Has anything changed? 

JD B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(3,788 Views)

If you look at the definition of the structure diffuse is an array of 4 and why can you get past this if you manually go from one material to the next (in the debugger force the index to change)?

 

The files include the original version that compiled in 8.5.1 and the one I was using to debug it, I have changed the order of the parameters in the structure but otherwise it should be the same as original.

 

I still have the original executable and it works fine and I can get the full original (untouched) 8.5.1 compilable code, I just don't have the capability of installing 8.5.1 on a clean system.

 

It is an easy test, on 2013 you can't even fully start the code, it fails before the the GUI fully comes up but you can use the debugger to get to the parts of the data that are supposedly in unaddressable memory.

0 Kudos
Message 3 of 5
(3,769 Views)

How many compiler warnings do you have turned on? Clang has many more options than the old LabWindows compiler, and they can be very helpful. I usually turn on all warnings with the exceptions below:

 

warnings.png

0 Kudos
Message 4 of 5
(3,745 Views)

I've busy putting out other fires but I'll look and try that when I get back to it, I'll also try it on 2012 (my other computer has that installed).

 

Thanks

0 Kudos
Message 5 of 5
(3,737 Views)