Skip to content

LLVM assertion failure with unreachable vector add #3029

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

Closed
catamorphism opened this issue Jul 26, 2012 · 6 comments
Closed

LLVM assertion failure with unreachable vector add #3029

catamorphism opened this issue Jul 26, 2012 · 6 comments
Labels
A-codegen Area: Code generation A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@catamorphism
Copy link
Contributor

fn fail_then_concat() {
    let x = ~[], y = ~[3];
    fail;
    x += y;
    ~"good" + ~"bye";
}

fn main() {}
rust: task failed at 'Assertion llvm::LLVMGetPointerAddressSpace(val_ty(val)) as uint == 1u failed', /Users/TimChevalier/rust/src/rustc/middle/trans/base.rs:2712
@ghost ghost assigned catamorphism Jul 26, 2012
catamorphism added a commit that referenced this issue Jul 26, 2012
@catamorphism
Copy link
Contributor Author

This seems to be a bug in liveness: because of the fail that dominates the vector add, the x += y doesn't get reported as illegal (since x is immutable). I don't know exactly why the assertion failure, but the code should get rejected beforehand anyway.

I don't really understand the liveness code, though; @nikomatsakis , maybe you can help me with this tomorrow when I'm back in the office.

@nikomatsakis
Copy link
Contributor

this is sort of... by design. but perhaps the design is wrong. that is, liveness sees that in any plausible execution of that fn, x can never be modified, so it is happy.

@catamorphism
Copy link
Contributor Author

I'm going to consider this to be a WONTFIX; I find the behavior a little weird, but I guess it can't be harmful.

@nikomatsakis
Copy link
Contributor

I disagree with closing this bug, though I agree it is not high priority.

@nikomatsakis
Copy link
Contributor

Do we even know what causes this failure in trans? My guess would be some sort of table that indicates whether a value is mutated. There used to be such a table that was used to decide whether a variable would be treated as "immediate" or stored on the stack. However, I thought that sully removed the use of this table a while and just stored all variables on the stack, as this is apparently what clang does anyway and makes things simple: so perhaps there is another table? Or I am wrong about this table having been removed? In either case, the fix is probably to modify the criteria used for listing things in this table, it's no doubt some sort of over-eager and possibly premature optimization.

@catamorphism
Copy link
Contributor Author

The trans failure appears to be magically fixed -- test case pushed in 885f0a2

@catamorphism catamorphism removed their assignment Jun 16, 2014
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
This improves the formatting and reading of code avoiding the
condition expression to be rewrite, if it goes multi line.

Fixes: rust-lang#3029.

Signed-off-by: Otavio Salvador <[email protected]>
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
Extends the multi line condition to over other control flow
expressions, it now covers: `if`, `if let`, `for`, `loop`, `while`,
`while let` and `match`.

Refs: rust-lang#3029

Signed-off-by: Otavio Salvador <[email protected]>
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 17, 2023
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-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants