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

segfault on i686-unknown-linux-gnu returning a struct from C #5347

Closed
brson opened this issue Mar 12, 2013 · 5 comments
Closed

segfault on i686-unknown-linux-gnu returning a struct from C #5347

brson opened this issue Mar 12, 2013 · 5 comments
Assignees
Labels
A-codegen Area: Code generation
Milestone

Comments

@brson
Copy link
Contributor

brson commented Mar 12, 2013

struct rust_dbg_struct {
    a: uint,
    b: uint
}

extern {
    fn rust_dbg_return_struct() -> rust_dbg_struct;
}

fn main() {
    unsafe {
        let s = rust_dbg_return_struct();
        fail_unless!(s.a == 10);
        fail_unless!(s.b == 20);
    }
}

The C code:

struct rust_dbg_struct {
    uintptr_t a;
    uintptr_t b;
};

extern "C" rust_dbg_struct
rust_dbg_return_struct() {
    struct rust_dbg_struct s;
    s.a = 10;
    s.b = 20;
    return s;
}

Related to #2064

@brson
Copy link
Contributor Author

brson commented Mar 12, 2013

Blocks #4419

@nikomatsakis
Copy link
Contributor

Also see src/test/run-pass/extern-pass-TwoU64s{,-ref}.rs which are currently xfail-test'd in relation to this issue

@nikomatsakis
Copy link
Contributor

The symptom is different but I suspect the underlying fault is the same.

brson added a commit to brson/rust that referenced this issue Apr 17, 2013


This Adds a bunch of tests for passing and returning structs
of various sizes to C. It fixes the struct return rules on unix,
and on windows for structs of size > 8 bytes. Struct passing
on unix for structs under a certain size appears to still be broken.
@graydon
Copy link
Contributor

graydon commented May 1, 2013

assigning bug; change assignment if you disagree

@ghost ghost assigned brson May 1, 2013
@brson
Copy link
Contributor Author

brson commented May 2, 2013

This is fixed, but #5745 is a followup.

@brson brson closed this as completed May 2, 2013
bors added a commit to rust-lang-ci/rust that referenced this issue May 2, 2020
…1995

Fix single binding closure

Fix the `match_single_binding` lint when triggered inside a closure.

Fixes: rust-lang#5347

changelog: Improve suggestion for [`match_single_binding`]
calebcartwright pushed a commit to calebcartwright/rust that referenced this issue Jan 24, 2023
* feat: add skip_macro_names option

* [review] update configuration documentation

* [review] fix docstring

* [feat] implement wildcard macro invocation skip

* commit missed files

* [review] test override skip macro names

* [review] skip_macro_names -> skip_macro_invocations

* [review] expand doc configuration

* [review] add lots more tests

* [review] add use alias test examples

* [review] add link to standard macro behaviour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

No branches or pull requests

3 participants