Skip to content

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

Closed
@efriedma-quic

Description

@efriedma-quic
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

Activity

added
clang:codegenIR generation bugs: mangling, exceptions, etc.
and removed on Mar 22, 2025
llvmbot

llvmbot commented on Mar 22, 2025

@llvmbot
Member

@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

self-assigned this
on Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

clang:codegenIR generation bugs: mangling, exceptions, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @dtcxzyw@efriedma-quic@llvmbot

    Issue actions

      -fwrapv-pointer doesn't affect member accesses · Issue #132449 · llvm/llvm-project