Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Bugs and Fixes

Initalized data size is too large

A community discussion post from the original code:zIRON forum.

0CodErr member
Posts
201
Threads
37
Location
Unknown

Initalized data size is too large

byte s1 [] = '123456';

Replies

0CodErr member
Posts
201
Threads
37
Location
Unknown

Seems it similar to this bug:

program RAW_IMAGE 'test';
#set bits 32;
#set awd true;
const str1 = 'mystr1\x0';
char buf[11] = str1;

Result:

6D 00 00 00 00 00 00 00 00 00 00

And this:

program RAW_IMAGE 'test';
#set bits 32;
#set awd true;
const str1 = 'mystr1\x0';
char buf[10] = str1;
EAccessViolation: Access violation
Colin admin
Posts
928
Threads
49
Location
Bulgaria

Fixed for next release, I also found a related bug which was outputting garbled characters in some cases.

0CodErr member
Posts
201
Threads
37
Location
Unknown

Still not fixed:

byte s1 [] = '123456';
Initalized data size is too large
0CodErr member
Posts
201
Threads
37
Location
Unknown
program RAW_IMAGE 'test';

#set bits 32;

#set awd true;
char* str1[2] = ['qwerty\x0', 
                 'asdfgh\x0'];

Compile -- ok, but actually Ziron craches.

Result only this:

71 77 65 72 61 73 64 66

In ascii:

qwerasdf
Colin admin
Posts
928
Threads
49
Location
Bulgaria
Initalized data size is too large

Fixed for next release.

Compile -- ok, but actually Ziron craches.

Also fixed for next release.

Regarding the output, it looks correct, char* is 4 bytes each, however this may be a good idea to allow ziron to create an array of pointers to strings, perfect for string tables, so maybe I will update this.

0CodErr member
Posts
201
Threads
37
Location
Unknown
this may be a good idea to allow ziron to create an array of pointers to strings

Yes, this of course good idea :)

Regarding the output, it looks correct

Seems it incorrect. Because if we use 'strings in quotes' then usually pointers to these strings used.

For example:

function  X(char* str1) {}
X('mystring');

Result:

00000000  6813000000        push dword 0x13
00000005  E800000000        call dword 0xa
0000000A  55                push ebp
0000000B  8BEC              mov ebp,esp
0000000D  8BE5              mov esp,ebp
0000000F  5D                pop ebp
00000010  C20400            ret 0x4
//.................................

Where

push dword 0x13

really uses address of string. String really at address 0x13.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Yes, this is usually the case for constant strings.

The 2 options are.... when you want to assign a string as characters to a variable you would use ord (regardless of size)....

Or the compiler detects pointer types and creates pointers to the data instead.