Skip to content

return fail!() interacts badly with while loop continuation #7714

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
MarkJr94 opened this issue Jul 11, 2013 · 1 comment
Closed

return fail!() interacts badly with while loop continuation #7714

MarkJr94 opened this issue Jul 11, 2013 · 1 comment
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@MarkJr94
Copy link
Contributor

I unfortunately cannot seem to isolate the issue into a small test case, but I am filing a bug for some help until I can.

Output of rustc --version

rustc 0.8-pre (9239d69 2013-07-10 23:37:40 -0700)
host: x86_64-unknown-linux-gnu

The relevant code is in file: https://github.com/MarkJr94/bzip2rs/blob/master/bzip2.rs

Specifically, the Bzip2Compressor::compress method failes with a segmentation fault. I checked using good old printf debugging, and the segfault is caused by the loop continuing to execute even though the condition here: https://github.com/MarkJr94/bzip2rs/blob/master/bzip2.rs#L180 is no longer true. Notably, an explicit break; statement, located here: https://github.com/MarkJr94/bzip2rs/blob/master/bzip2.rs#L207-L210 did not fix the issue.

The data I am compressing is the file itself, which you can see in the main function here: https://github.com/MarkJr94/bzip2rs/blob/master/bzip2.rs#L481-L502

When I perform rustc --bin bzip2.rs && ./bzip2 I get a segmentation fault.

I tracked down the error with some help from the lovely folks on IRC, and noticed if I changed this line: https://github.com/MarkJr94/bzip2rs/blob/master/bzip2.rs#L193
from return fail!(); to fail!(); the code worked as expected. Simply commenting out this entire block https://github.com/MarkJr94/bzip2rs/blob/master/bzip2.rs#L191-L194 also makes things work. The issue seems to be with the return fail!(); and I was told on IRC to file this issue, as it seems seperate from #6675.

I am continuing to work on isolating the issue.

@emberian
Copy link
Member

@MarkJr94 unless you have any update on this, I'm going to close it as there's nothing really actionable here.

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 29, 2022
`not_unsafe_ptr_arg_deref` update documentation

changelog: [`not_unsafe_ptr_arg_deref`]: strengthened documentation wording, fixes rust-lang#7714
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-codegen Area: Code generation 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

2 participants