Skip to content

c_char on AIX should be u8 #122985

Closed
Closed
@taiki-e

Description

Currently, core::ffi::c_char on AIX is i8, but AFAIK, the default of this platform is unsigned (u8).

XL C for AIX:

Defaults
-qchars=unsigned

Clang:

$ clang --version
Homebrew clang version 17.0.6

$ clang -E -dM -x c /dev/null -target powerpc64-ibm-aix | grep __CHAR_        
#define __CHAR_BIT__ 8
#define __CHAR_UNSIGNED__ 1

Rust:

$ tail -2 src/lib.rs 

const C: core::ffi::c_char = 0u8;

$ cargo check -Zbuild-std=core --target powerpc64-ibm-aix
error[E0308]: mismatched types
    --> src/lib.rs:3972:30
     |
3972 | const C: core::ffi::c_char = 0u8;
     |                              ^^^ expected `i8`, found `u8`
     |
help: change the type of the numeric literal from `u8` to `i8`
     |
3972 | const C: core::ffi::c_char = 0i8;
     |                               ~~

cc @ecnelises @bzEq (target maintainers)

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (2f090c30d 2024-03-23)
binary: rustc
commit-hash: 2f090c30ddd6b3bbe5c81c087579a5166e7c7278
commit-date: 2024-03-23
host: aarch64-apple-darwin
release: 1.79.0-nightly
LLVM version: 18.1.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-ABIArea: Concerning the application binary interface (ABI)C-bugCategory: This is a bug.O-aixOS: Big Blue's Advanced Interactive eXecutive..T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions