Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer-Arithmetic: assigning a pointer's address to a DWORD #353

Closed
riederm opened this issue Oct 29, 2021 · 3 comments · Fixed by #388
Closed

Pointer-Arithmetic: assigning a pointer's address to a DWORD #353

riederm opened this issue Oct 29, 2021 · 3 comments · Fixed by #388
Assignees
Labels
compatibility-oscat syntax or semantics which are not necessarily part of the standard, but seen in the oscat-libraries
Milestone

Comments

@riederm
Copy link
Collaborator

riederm commented Oct 29, 2021

in oscat's basic library they allow to assign a pointer directly to a dword, catching it's adress. We cannot handle this situation - it is dubious situation to do this without a casting-function.

FUNCTION _BUFFER_CLEAR : BOOL
VAR_INPUT
	PT : POINTER TO BYTE;
	SIZE : UINT;
END_VAR
VAR
	temp: DWORD;
END_VAR

temp := pt;
//etc.
END_FUNCTION

this code can be found in the oscat basic library.

@riederm riederm added the compatibility-oscat syntax or semantics which are not necessarily part of the standard, but seen in the oscat-libraries label Oct 29, 2021
@ghaith ghaith added this to the oscat milestone Oct 29, 2021
@ghaith
Copy link
Collaborator

ghaith commented Nov 1, 2021

I think a general issue with our pointers (or with the norm definition of WORD) is that our pointers will not fit in WORD/DWORD on 64bit architectures
We will need to move these functions to LWORD in oscat or abstract it away behind a PTR_SIZE type or something similar which is set based on the architecture.

@riederm
Copy link
Collaborator Author

riederm commented Nov 2, 2021

hmm ... having an additional type that reflects your adress-size is the best solution in my optionion. Would we need something like a compatibility-guide?

@create-issue-branch
Copy link

riederm added a commit that referenced this issue Dec 2, 2021
adress-of expressions now result in pointer-types that will
be added dynamically to the index

fixes #353
riederm added a commit that referenced this issue Dec 4, 2021
adress-of expressions now result in pointer-types that will
be added dynamically to the index

fixes #353

Co-authored-by: Ghaith Hachem <ghaith.hachem@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-oscat syntax or semantics which are not necessarily part of the standard, but seen in the oscat-libraries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants