llvm / llvm/llvm-project

sizeof(ssize_t) is not equal to sizeof(size_t) for some 64-bit targets by clang

Open
#198,975 8 comments 0 reactions 0 assignees View on GitHub
ABI clang:frontend confirmed diverges-from:gcc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The code example: https://godbolt.org/z/Y5WWTYGza

-O1 --target=aarch64-unknown-linux-gnu
-O1 --target=mips64-unknown-linux-gnu
-O1 --target=riscv64-unknown-linux-gnu
-O1 --target=riscv64be-unknown-linux-gnu
-O1 --target=ppc64-unknown-linux-gnu
-O1 --target=ppc64le-unknown-linux-gnu

Rationale:

https://www.mail-archive.com/austin-group-l@opengroup.org/msg14371.html

The gcc for these target triple that can ensure sizeof(ssize_t) === sizeof(size_t)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Godbolt example with Clang at -O1 for the listed 64-bit target triples, then compare the resulting sizeof(ssize_t) and sizeof(size_t) with the stated GCC behavior. Read the Austin Group rationale and trace the relevant target-specific type definitions. Done means the sizes agree for the reported targets and regression coverage verifies them.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.