Jump to content
Sign in to follow this  
MrDummy1

Static Storage Not Initalized As Expected

Recommended Posts

Hi SourceBoost team,

 

To reproduce take the following example:

 

char a;

char b = 1;

char test1[1];

char test2[2];

char test3[2] = { 1 };

char test4[2] = { 2, 0 };

 

void main(void)

{}

 

 

With or without the -Su option boostc (tested with boostc 6.97 for a PIC12F615) generates

 

char a;

char b = 1;

01D5 3001 MOVLW 0x01

01D6 00D3 MOVWF gbl_b

 

char test1[1];

char test2[2];

char test3[2] = { 1 };

01D7 3001 MOVLW 0x01

01D8 00CB MOVWF gbl_test3

 

char test4[2] = { 2, 0 };

01D9 3002 MOVLW 0x02

01DA 00CD MOVWF gbl_test4

01DB 01CE CLRF gbl_test4+D'1'

 

According to Ansi (9899/1999 6.7.8) all unused elements should be set to 0, which I expected boostc to do if I left out the -Su flag.

 

I retested with extra code referencing the uninitalized vars in case the compiler optimized them away, but this did not make any difference.

 

Regards,

MrDummy1

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...