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

C's (Optional) Named Integer Types #169

Open
lenary opened this issue Jan 12, 2021 · 3 comments
Open

C's (Optional) Named Integer Types #169

lenary opened this issue Jan 12, 2021 · 3 comments

Comments

@lenary
Copy link
Contributor

lenary commented Jan 12, 2021

I think clang and gcc currently disagree on the size and alignment of int_fastN_t and int_leastN_t in some places. GCC is likely correct, as clang will always match those two.

Do we want to codify this in the psABI?

I looked at making the Clang changes required, and they were fairly involved - https://reviews.llvm.org/D80963 was the initial bit, but clang also has a stdint.h implementation for freestanding mode which is not very much fun to edit and improve.

If we don't want to codify it, we should also say that, maybe. I don't know what people feel is reasonable.

@aswaterman
Copy link
Contributor

aswaterman commented Jan 13, 2021

These affect the calling convention, struct layout, etc., so I think we basically have to codify them.

It looks like, for GCC, all glibc targets use the same definitions: fast8 is char; the others are long. I can't say I understand why fast8 is the way that it is--maybe they felt that in this case potential for memory waste outweighed the perf gain from using a register-sized type?--but the rest are sensible. https://github.com/gcc-mirror/gcc/blob/master/gcc/config/glibc-stdint.h

@nick-knight
Copy link
Contributor

My opinion is that this stuff really belongs in the C API. See, e.g.,
riscv-non-isa/riscv-c-api-doc#14
However, there is (apparently) now a psABI working group, whereas I don't think the same is true for the C API.

@aswaterman
Copy link
Contributor

Ah, yeah, I agree; I suppose my point is that it should be standardized, not that it should be standardized in this doc.

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

No branches or pull requests

3 participants