Skip to content

-fwrapv-pointer doesn't affect member accesses #132449

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

Closed
efriedma-quic opened this issue Mar 21, 2025 · 1 comment · Fixed by #134269
Closed

-fwrapv-pointer doesn't affect member accesses #132449

efriedma-quic opened this issue Mar 21, 2025 · 1 comment · Fixed by #134269
Assignees
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc.

Comments

@efriedma-quic
Copy link
Collaborator

Compile the following with -fwrapv-pointer:

struct S { int x,y; };
int *a(struct S *x) { return &x->y; }

Produces getelementptr inbounds nuw %struct.S, ptr %0, i32 0, i32 1... which seems counter to the premise of -fwrapv-pointer. And seems like it might be a problem with #130742 .

CC @dtcxzyw @nikic

@dtcxzyw dtcxzyw added clang:codegen IR generation bugs: mangling, exceptions, etc. and removed new issue labels Mar 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 22, 2025

@llvm/issue-subscribers-clang-codegen

Author: Eli Friedman (efriedma-quic)

Compile the following with -fwrapv-pointer:
struct S { int x,y; };
int *a(struct S *x) { return &x->y; }

Produces getelementptr inbounds nuw %struct.S, ptr %0, i32 0, i32 1... which seems counter to the premise of -fwrapv-pointer. And seems like it might be a problem with #130742 .

CC @dtcxzyw @nikic

@dtcxzyw dtcxzyw self-assigned this Apr 3, 2025
@dtcxzyw dtcxzyw closed this as completed in c048073 Apr 9, 2025
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this issue Apr 9, 2025
…uct GEPs (#134269)

This patch turns off inbounds/nuw flags for member accesses when
`-fwrapv-pointer` is set.

Closes llvm/llvm-project#132449.

It is required by llvm/llvm-project#130734.
AllinLeeYL pushed a commit to AllinLeeYL/llvm-project that referenced this issue Apr 10, 2025
…lvm#134269)

This patch turns off inbounds/nuw flags for member accesses when
`-fwrapv-pointer` is set.

Closes llvm#132449.

It is required by llvm#130734.
var-const pushed a commit to ldionne/llvm-project that referenced this issue Apr 17, 2025
…lvm#134269)

This patch turns off inbounds/nuw flags for member accesses when
`-fwrapv-pointer` is set.

Closes llvm#132449.

It is required by llvm#130734.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants