-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
When compiling with LTO enabled, CStr::from_bytes_with_nul(b"\0") returns an error. Without LTO, it returns Ok. The former result seems incorrect. The following terminal session should help illustrate:
% cat testing.rs
use std::ffi::CStr;
fn main()
{
println!("{:?}", CStr::from_bytes_with_nul(b"\0"));
}
% rustc testing.rs -C opt-level=3 -C lto
% ./testing
Err(FromBytesWithNulError { _a: () })
% rustc testing.rs -C opt-level=3
% ./testing
Ok("")
% rustc --version
rustc 1.15.1 (021bd294c 2017-02-08)
durka, retep998 and hanna-kruppe
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.