]> git.lizzy.rs Git - rust.git/commit
rustc: handle allocas and LoadRangeAsserts in unreachable blocks correctly.
authorHuon Wilson <dbau.pp+github@gmail.com>
Wed, 17 Jul 2013 08:13:23 +0000 (03:13 -0500)
committerHuon Wilson <dbau.pp+github@gmail.com>
Tue, 16 Jul 2013 17:13:23 +0000 (03:13 +1000)
commite252277fe9b44ed9a913aeeb9f55dc85eaadace4
treef4c5efcf4e52b091b3053fa438d83035c5c06fb8
parente4f7561bcdf3b54dafefd478b86e1f7610e74348
rustc: handle allocas and LoadRangeAsserts in unreachable blocks correctly.

An alloca in an unreachable block would shortcircuit with Undef, but with type
`Type`, rather than type `*Type` (i.e. a plain value, not a pointer) but it is
expected to return a pointer into the stack, leading to confusion and LLVM
asserts later.

Similarly, attaching the range metadata to a Load in an unreachable block
makes LLVM unhappy, since the Load returns Undef.

Fixes #7344.
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/datum.rs
src/test/run-pass/issue-7344.rs [new file with mode: 0644]