<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to error "iDummyBitOffset == -1"</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/14a2be5bf4/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/14a2be5bf4/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/14a2be5bf4/</id><updated>2020-02-27T21:40:38.089000Z</updated><subtitle>Recent posts to error "iDummyBitOffset == -1"</subtitle><entry><title>error "iDummyBitOffset == -1"</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/14a2be5bf4/?limit=25#71c4" rel="alternate"/><published>2020-02-27T21:40:38.089000Z</published><updated>2020-02-27T21:40:38.089000Z</updated><author><name>spfeif</name><uri>https://forge.codesys.com/u/spfeif/</uri></author><id>https://forge.codesys.com2b96497b3b624fd35a98a2d0a2bda9d06f7eeab2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Might I add one thing you are checking a constant "size" defined as 0 if it is greater than &amp;gt; 0  ? The constant will not change?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>error "iDummyBitOffset == -1"</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/14a2be5bf4/?limit=25#f322" rel="alternate"/><published>2020-02-27T21:40:33.945000Z</published><updated>2020-02-27T21:40:33.945000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com7d6f47085eba0b0462ad6c591ad476e09e108b62</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;LOL&lt;/p&gt;
&lt;p&gt;you define an array with -1 members&lt;br/&gt;
if size = 0 then this is fault.&lt;br/&gt;
v : ARRAY&lt;span&gt;[1..size]&lt;/span&gt; OF INT;&lt;br/&gt;
if you change the 1 to a zero always 1 member will be made.&lt;br/&gt;
that is the minimum.&lt;br/&gt;
you can not create an array with 0&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>error "iDummyBitOffset == -1"</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/14a2be5bf4/?limit=25#666c" rel="alternate"/><published>2020-02-27T21:40:32.439000Z</published><updated>2020-02-27T21:40:32.439000Z</updated><author><name>Fabio79</name><uri>https://forge.codesys.com/u/fabio79/</uri></author><id>https://forge.codesys.com3347c95db27138e2bbefc735cb3665f015f9f416</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I am using Codesys for ABB.&lt;br/&gt;
The editor crashes and I find this error when, in simulation mode, I just try to open and visualize a module containing a vector with size 0. The error appears even when you login in simulation, without running the project.&lt;/p&gt;
&lt;p&gt;The reason why I have a vector with size 0 is simply because I want to generalize the modules of my own library: I set the size of the vector to 0 on the PLCs where I don't need to use that vector, instead of commenting code around the imported module.&lt;/p&gt;
&lt;p&gt;Here there is a simple code that reproduces the crash:&lt;/p&gt;
&lt;p&gt;VAR CONSTANT&lt;br/&gt;
    size : INT := 0;    (&lt;em&gt; size &amp;gt;= 1: no problems &lt;/em&gt;)&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;VAR&lt;br/&gt;
    i   : INT;&lt;br/&gt;
    v   : ARRAY&lt;span&gt;[1..size]&lt;/span&gt; OF INT;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; PLC_PRG: &lt;/em&gt;)&lt;br/&gt;
IF size&amp;gt;0 THEN              (&lt;em&gt; this IF should be enough to avoid an erroneous access to v&lt;span&gt;&lt;span&gt;[1]&lt;/span&gt;&lt;/span&gt; e v&lt;span&gt;&lt;span&gt;[0]&lt;/span&gt;&lt;/span&gt; &lt;/em&gt;)&lt;br/&gt;
    FOR i:=1 TO size DO     (&lt;em&gt; but codesys crashes anyway when you login &lt;/em&gt;)&lt;br/&gt;
        v&lt;span&gt;[i]&lt;/span&gt; := 1;&lt;br/&gt;
    END_FOR&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;Strange is that this error appears only when I debug the code: I manage to download this code on a PLC and the program run! Only the editor crashes..&lt;/p&gt;
&lt;p&gt;I would really appreciate every opinion on this matter!&lt;br/&gt;
Thank's!&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: error Codesys.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=285"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=284" rel="nofollow"&gt;vector.pro &lt;span&gt;&lt;span&gt;[103.11 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>