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

fix(cmd_parse): command parsing on arm machines #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joennlae
Copy link

Problem

This benchmark will always exit through the print_usage in the default switch case on ARM machines.

rma-mt/src/rmamt_options.c

Lines 234 to 236 in d09c4d0

default:
print_usage (name, true);
}

As the getlong_opt returns an int and c is defined as char

while (-1 != (c = getopt_long (argc, argv, "wi:t:bhz:o:s:m:l:xr:", options, NULL))) {

char c, *tmp;

On x86 this is not an issue but on arm this can never exit as -1 will be converted into 255 and it end up in the default switch statement.

This PR fixes

  • fixing command parsing as some compiler do not auto correct the -1 to a char type

  • also I needed to use ./configure LIBS="-lpthread" to make it compile

More infos

Compiler Explorer

I think cmp on arm

cmp     r3, #-1

yields different flags than the `cmp on x86

cmp     BYTE PTR [rbp-1], -1

* fixing command parsing as some compiler do not auto correct the -1 to a char type

* also I needed to use ./configure LIBS="-lpthread" to make it compile
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.

1 participant