Skip to content

Remove noalias on return values#22018

Closed
dotdash wants to merge 1 commit intorust-lang:masterfrom
dotdash:bad_noalias
Closed

Remove noalias on return values#22018
dotdash wants to merge 1 commit intorust-lang:masterfrom
dotdash:bad_noalias

Conversation

@dotdash
Copy link
Copy Markdown
Contributor

@dotdash dotdash commented Feb 6, 2015

On return values noalias has a stricter meaning than on arguments. It
means that the function is malloc-like. To quote the LLVM docs:

Furthermore, the semantics of the noalias attribute on return values
are stronger than the semantics of the attribute when used on
function arguments. On function return values, the noalias attribute
indicates that the function acts like a system memory allocation
function, returning a pointer to allocated storage disjoint from the
storage for any other object accessible to the caller.

We use it for all kinds of functions, which is wrong, so let's stop
doing that.

Fixes #21996

On return values `noalias` has a stricter meaning than on arguments. It
means that the function is malloc-like. To quote the LLVM docs:

    Furthermore, the semantics of the noalias attribute on return values
    are stronger than the semantics of the attribute when used on
    function arguments. On function return values, the noalias attribute
    indicates that the function acts like a system memory allocation
    function, returning a pointer to allocated storage disjoint from the
    storage for any other object accessible to the caller.

We use it for all kinds of functions, which is wrong, so let's stop
doing that.

Fixes rust-lang#21996
@rust-highfive
Copy link
Copy Markdown
Contributor

r? @nick29581

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Copy Markdown
Member

@bors: r+ 7fbcdf6 rollup

@alexcrichton alexcrichton assigned alexcrichton and unassigned nrc Feb 6, 2015
@alexcrichton
Copy link
Copy Markdown
Member

@bors: r-

@dotdash
Copy link
Copy Markdown
Contributor Author

dotdash commented Feb 6, 2015

I just realized that the rationale given here makes no sense at all. The attribute is on a sret argument, not actually a return value. Will need more analysis

@dotdash
Copy link
Copy Markdown
Contributor Author

dotdash commented Feb 7, 2015

Yeah, this just worked around the actual issue that caused #21996.

@dotdash dotdash closed this Feb 7, 2015
@dotdash dotdash deleted the bad_noalias branch February 6, 2018 08:48
lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 20, 2026
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

Successfully merging this pull request may close these issues.

LLVM poisons partially undef constant, leading to infinite loops.

4 participants