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

defragfs.ocfs2: make getopt return variable portable #43

Merged
merged 1 commit into from Sep 3, 2019
Merged

defragfs.ocfs2: make getopt return variable portable #43

merged 1 commit into from Sep 3, 2019

Conversation

rafaeldtinoco
Copy link
Contributor

Fixes #42

From ISO/IEC 9899:1999 (E):

6.3.1.3 Signed and unsigned integers

1 When a value with integer type is converted to another integer type
other than _Bool, if the value can be represented by the new type, it is
unchanged.

2 Otherwise, if the new type is unsigned, the value is converted by
repeatedly adding or subtracting one more than the maximum value that
can be represented in the new type until the value is in the range of
the new type.

3 Otherwise, the new type is signed and the value cannot be represented
in it; either the result is implementation-defined or an
implementation-defined signal is raised.

gcc-9-aarch64-linux-gnu 9.2.1 makes ((char = getopt()) != EOF) to always
compare (255 != -1), considering char to be unsigned, as states item
(3): implementation-defined. Meaning that the code has to change "char"
to "int" to become fully portable.

Bug: https://bugs.launchpad.net/bugs/1840958

Signed-off-by: Rafael David Tinoco rafaeldtinoco@ubuntu.com

Fixes #42

From ISO/IEC 9899:1999 (E):

6.3.1.3 Signed and unsigned integers

1 When a value with integer type is converted to another integer type
other than _Bool, if the value can be represented by the new type, it is
unchanged.

2 Otherwise, if the new type is unsigned, the value is converted by
repeatedly adding or subtracting one more than the maximum value that
can be represented in the new type until the value is in the range of
the new type.

3 Otherwise, the new type is signed and the value cannot be represented
in it; either the result is implementation-defined or an
implementation-defined signal is raised.

gcc-9-aarch64-linux-gnu 9.2.1 makes ((char = getopt()) != EOF) to always
compare (255 != -1), considering char to be unsigned, as states item
(3): implementation-defined. Meaning that the code has to change "char"
to "int" to become fully portable.

Bug: https://bugs.launchpad.net/bugs/1840958

Signed-off-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
@josephhz josephhz merged commit 8b3dad1 into markfasheh:master Sep 3, 2019
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.

defrag hangs on arm64, ppc64el
2 participants