It is currently Wed Nov 13, 2019 11:41 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: [PB5.10 b5] Assembler error involving quad / static array
PostPosted: Sat Feb 02, 2013 7:03 pm 
Offline
PureBasic Fanatic
PureBasic Fanatic

Joined: Fri Dec 09, 2005 12:15 pm
Posts: 2236
Location: Elbonia
The following code doesn't compile and shows an assembler error:

Code:
Structure mystruct
  sa.q[1]
EndStructure

a.mystruct
b.q = 0
a\sa[b] = 12345


Details:
Quote:
PureBasic - Assembler error
PureBasic.asm [110]:
MOV eax, qword [v_b]
error: operand sizes do not match.

_________________
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.10 b5] Assembler error involving quad / static arra
PostPosted: Sat Feb 02, 2013 8:04 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3110
Location: Boston, MA
Interesting bug.
Workaround...
Code:
Structure mystruct
  sa.q[0]
EndStructure

a.mystruct
b.q = 1
a\sa[b] = 12345
Debug a\sa[0]
Debug a\sa[1]

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.10 b5] Assembler error involving quad / static arra
PostPosted: Sat Feb 02, 2013 8:14 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3699
Location: Berlin, Germany
Inf0Byt3 wrote:
The following code doesn't compile and shows an assembler error:

Code:
Structure mystruct
  sa.q[1]
EndStructure

a.mystruct
b.q = 0
a\sa[b] = 12345

It seems to me that the index can not be a quad, but only a long (at least on 32 bit systems).
Using b.i = 0 works fine here.
However, I cannot find where this is written in the docs.

Regards, Little John

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.10 b5] Assembler error involving quad / static arra
PostPosted: Sat Feb 02, 2013 8:21 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5755
Location: Berlin - Germany
The arraysize is limited to integer. This is a C-Like structuremember, only to make it possible to use
some c-libs, so it is not documented. It is like API.

http://stackoverflow.com/questions/216259/is-there-a-max-array-length-limit-in-c wrote:
The first limit (should never be reached) is set by the restrictions of the size type used to describe an index in the array (and the size thereof). It is given by the maximum value the system's std::size_t can take. This data type should always be the largest integer type of a system.

Not a bug.

Greetings - Thomas

_________________
PureBasic 5.71 | SpiderBasic 2.21 | Windows 10 Pro (x64) | Linux Mint 19.2 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.10 b5] Assembler error involving quad / static arra
PostPosted: Sat Feb 02, 2013 8:56 pm 
Offline
PureBasic Fanatic
PureBasic Fanatic

Joined: Fri Dec 09, 2005 12:15 pm
Posts: 2236
Location: Elbonia
ts-soft wrote:
The arraysize is limited to integer. This is a C-Like structuremember, only to make it possible to use
some c-libs, so it is not documented. It is like API.


Indeed, that makes sense, but my report is directed more towards the compiler generating non-working code. Maybe the team could implement a check for the 32-bit compiler / debugger so only variables smaller or equal to the integer size can be passed?

Little John wrote:
However, I cannot find where this is written in the docs.


If this falls under what TS-Soft said, a mention in the documentation would be great, especially if a check can't be added.

_________________
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.10 b5] Assembler error involving quad / static arra
PostPosted: Sat Feb 02, 2013 10:47 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Aug 16, 2010 4:29 am
Posts: 252
Even if use b.i with sa.b, there is something unfortunate going on that limits 64 bit code.
Old 32 bit FASM memory settings?
Code:
Structure mystruct
  ;sa.b[$2fff0000]; This works on PB64/Win7 with 8GB unallocated physical memory
   sa.b[$2ffff000]; This fails with PureBasic Assembler error: out of memory   
EndStructure

a.mystruct
b.i = 123
a\sa[b] = 100
Debug a\sa[b]


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.10 b5] Assembler error involving quad / static arra
PostPosted: Sat Feb 02, 2013 10:58 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5755
Location: Berlin - Germany
@buddymatkona
Works fine here, with x86 and x64

_________________
PureBasic 5.71 | SpiderBasic 2.21 | Windows 10 Pro (x64) | Linux Mint 19.2 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.10 b5] Assembler error involving quad / static arra
PostPosted: Sun Feb 03, 2013 2:41 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Aug 16, 2010 4:29 am
Posts: 252
@ts-soft
It is repeatable here so I will run some diagnostics. Thanks for the feedback.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye