Skip to content

bindings: ruby: fix unexpected uc_query result pointer type#1962

Merged
wtdcode merged 1 commit intounicorn-engine:devfrom
anthraxx:fix/bindings-ruby-gcc-ptr-type
Apr 4, 2025
Merged

bindings: ruby: fix unexpected uc_query result pointer type#1962
wtdcode merged 1 commit intounicorn-engine:devfrom
anthraxx:fix/bindings-ruby-gcc-ptr-type

Conversation

@anthraxx
Copy link
Copy Markdown
Contributor

@anthraxx anthraxx commented Jun 5, 2024

uc_query expects a size_t *, while we are passing uc_arch *. This has been working for a while as gcc just warned about this, however with latest gcc this changed into an error:

unicorn.c:122:34: error: passing argument 3 of ‘uc_query’ from incompatible pointer type [-Wincompatible-pointer-types]
206 | uc_query(_uc, UC_QUERY_ARCH, &arch);
unicorn.h:689:60: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘uc_arch *’
689 | uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result);

Fix this issue by querying the result into a size_t and later downcast the result into an uc_arch enum.

@wtdcode
Copy link
Copy Markdown
Member

wtdcode commented Jul 19, 2024

Could you send this to the dev branch?

uc_query expects a size_t *, while we are passing uc_arch *. This has
been working for a while as gcc just warned about this, however with
latest gcc this changed into an error:

unicorn.c:122:34: error: passing argument 3 of ‘uc_query’ from incompatible pointer type [-Wincompatible-pointer-types]
  206 |     uc_query(_uc, UC_QUERY_ARCH, &arch);
unicorn.h:689:60: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘uc_arch *’
  689 | uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result);

Fix this issue by querying the result into a size_t and later downcast
the result into an uc_arch enum.
@anthraxx anthraxx changed the base branch from master to dev April 3, 2025 18:44
@anthraxx anthraxx force-pushed the fix/bindings-ruby-gcc-ptr-type branch from 0763810 to 8f266d7 Compare April 3, 2025 18:45
@anthraxx
Copy link
Copy Markdown
Contributor Author

anthraxx commented Apr 3, 2025

Could you send this to the dev branch?

changed the base, is this ready to merge otherwise?

@wtdcode
Copy link
Copy Markdown
Member

wtdcode commented Apr 3, 2025

Sure yes, just wait for CI.

@wtdcode wtdcode merged commit 1aad423 into unicorn-engine:dev Apr 4, 2025
44 checks passed
amaanq pushed a commit to amaanq/unicorn that referenced this pull request Apr 14, 2025
…engine#1962)

uc_query expects a size_t *, while we are passing uc_arch *. This has
been working for a while as gcc just warned about this, however with
latest gcc this changed into an error:

unicorn.c:122:34: error: passing argument 3 of ‘uc_query’ from incompatible pointer type [-Wincompatible-pointer-types]
  206 |     uc_query(_uc, UC_QUERY_ARCH, &arch);
unicorn.h:689:60: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘uc_arch *’
  689 | uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result);

Fix this issue by querying the result into a size_t and later downcast
the result into an uc_arch enum.
Antelox pushed a commit to Antelox/unicorn that referenced this pull request Jul 29, 2025
…engine#1962)

uc_query expects a size_t *, while we are passing uc_arch *. This has
been working for a while as gcc just warned about this, however with
latest gcc this changed into an error:

unicorn.c:122:34: error: passing argument 3 of ‘uc_query’ from incompatible pointer type [-Wincompatible-pointer-types]
  206 |     uc_query(_uc, UC_QUERY_ARCH, &arch);
unicorn.h:689:60: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘uc_arch *’
  689 | uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result);

Fix this issue by querying the result into a size_t and later downcast
the result into an uc_arch enum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants