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 from using casted trait #4333

Closed
14427 opened this issue Jan 2, 2013 · 5 comments
Closed

Segfault from using casted trait #4333

14427 opened this issue Jan 2, 2013 · 5 comments
Labels
A-codegen Area: Code generation A-trait-system Area: Trait system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@14427
Copy link
Contributor

14427 commented Jan 2, 2013

Updated Test Case (warning: may not be faithful to the original problem)

use core::io::ReaderUtil;
use core::io::Reader;

fn foo(r:@Reader) -> ~str { r.read_line() }
fn baz<R:Reader>(r:R) -> ~str { r.read_line() }
fn waz<R:ReaderUtil>(r:R) -> ~str { r.read_line() }

fn main() {
    let _m = foo(io::stdin());
    let _m = baz(io::stdin());
    let _m = waz(io::stdin());
}

Original Report

The following code compiles, but causes a segmentation fault when run:

let stdin = io::stdin() as &io::ReaderUtil;
let _m = stdin.read_line();

This is using master on Ubuntu.

@ghost ghost assigned catamorphism Jan 3, 2013
@catamorphism
Copy link
Contributor

I'll look at this, since I was working on something similar.

@pnkfelix
Copy link
Member

I cannot duplicate this on Mac OS X.

@pnkfelix
Copy link
Member

Note that in my comment above, I was testing against an "updated" version of the code that may not be faithful to the original bug scenario. But if that is the case, it may also be the case that this bug has gone away with type-checker changes since it was filed...

catamorphism added a commit to catamorphism/rust that referenced this issue Mar 29, 2013
@catamorphism
Copy link
Contributor

Seems to be fixed; pending #5619 for the test case. (I chose to add the original test case, except with stdin changed to stdout so we don't have a test case reading input, for fidelity to the original bug.)

@catamorphism
Copy link
Contributor

Test case merged in 318d926 - closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-trait-system Area: Trait system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

3 participants