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

Restrict lambda-blocks to occuring as function call arguments #851

Closed
msullivan opened this issue Aug 19, 2011 · 2 comments
Closed

Restrict lambda-blocks to occuring as function call arguments #851

msullivan opened this issue Aug 19, 2011 · 2 comments

Comments

@msullivan
Copy link
Contributor

Right now they are permitted anywhere.

@msullivan
Copy link
Contributor Author

Without doing this we are unsound, as you could assign a block to a lambda, deinitialize variables it refers to, and then call the lambda.

@graydon
Copy link
Contributor

graydon commented Feb 14, 2012

I believe this is long-since obsolete.

@graydon graydon closed this as completed Feb 14, 2012
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
…xcrichton

Several fixes for DragonFly

With these changes in place, crate "nix" works (with some patches applied).
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
* Manually preserve rbx across cpuid instruction

This fixes an issue observed when using __cpuid and __cpuid_count with
Address Sanitizer enabled: the generated code uses the rbx register to
access ASAN tracking information without reloading it after cpuid,
resulting in a segfault since the rbx register is overwritten by cpuid
(https://crbug.com/1072045).

This seems like a compiler backend bug, and indeed there is a
long-standing LLVM bug report about a very similar issue:
https://bugs.llvm.org/show_bug.cgi?id=17907

To work around this issue, we can manually preserve the rbx register
contents in the inline assembly.  This is the approach taken by LLVM's
own host cpuid detection code (lib/Host/Support.cpp).  The original rbx
value is stashed in rsi, which is then swapped with rbx to restore the
original value as well as keep the output ebx value from the CPUID
instruction to be used as an output of the inline assembly.

The rbx clobber is also removed; this seems ineffective, and it
conflicts with the ebx output of the inline assembly (ebx is a
subregister of rbx): "Note that clobbering named registers that are also
present in output constraints is not legal."
(https://llvm.org/docs/LangRef.html#clobber-constraints)

* Add link to LLVM bug in cpuid workaround comment
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Add test for `likely` and `unlikely` intrinsics.

* Format

* Remove let statments
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

2 participants