Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --Hi I got two confusions when trying to use and integrate some assembly codes. got the internal compiler error listed as below; error messages look wierd with arrows confusingly pointing to blankets or some existing labels. (If I just misunderstood them please correct me) Any Help would be appreciated very much :D func.S: bug.s: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
You can't use with assembly code used by . This requires running a C pre-processor over the assembly code which can only be done with . However the assertion failure is still a real issue in the compiler.
! () Is it not allowed to use as comments?
It won't include , which is what the originally assembly code intended to do. It will instead just be parsed as a comment and ignored.
Ohh ok I get it. Thank you for your explanations :D
I can't reproduce the assertion failure in the latest rustc:
Maybe try this one? I try to update the rustc version, but the error still exists. I use and to check the assembly files that can and can't reproduce the ICE, and find some differences: their encodings differ with terminators, one with (with ICE) and another with only (without ICE). Also, error information about compiling with assembly files with displays arrows confusingly pointing to blankets, but for files with only , error info is the same as yours'. Arrows point to the beginning of the tags or instructions, which makes sense in a way. I don't know whether the terminator is the root cause. Hope that could help figure it out. The new meta info I get after updating the rustc version: <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</detailsThe files that can cause the compiler error: func.S -bug.S - The files that won't cause the compiler error: func.S -bug.S -

Discussion:
let source = sess .source_map() .new_source_file(FileName::inline_asm_source_code(&buffer), buffer); <del> let source_span = Span::with_root_ctxt(source.start_pos, source.end_pos); let spans: Vec<_> = spans.iter().map(|sp| source_span.from_inner(*sp)).collect(); </del> <ins> let spans: Vec<_> = spans .iter() .map(|sp| { Span::with_root_ctxt( source.normalized_byte_pos(sp.start as u32), source.normalized_byte_pos(sp.end as u32), ) }) .collect(); </ins> err.span_note(spans, "instantiated into assembly here"); }

BytePos::from_u32(pos.0 - self.start_pos.0 + diff) } <ins> /// Calculates a normalized byte position from a byte offset relative to the /// start of the file. /// /// When we get an inline assembler error from LLVM during codegen, we /// import the expanded assembly code as a new `SourceFile`, which can then /// be used for error reporting with spans. However the byte offsets given /// to us by LLVM are relative to the start of the original buffer, not the /// normalized one. Hence we need to convert those offsets to the normalized /// form when constructing spans. pub fn normalized_byte_pos(&self, offset: u32) -> BytePos { let diff = match self .normalized_pos .binary_search_by(|np| (np.pos.0 + np.diff).cmp(&(self.start_pos.0 + offset))) { Ok(i) => self.normalized_pos[i].diff, Err(i) if i == 0 => 0, Err(i) => self.normalized_pos[i - 1].diff, }; BytePos::from_u32(self.start_pos.0 + offset - diff) } </ins> /// Converts an absolute `BytePos` to a `CharPos` relative to the `SourceFile`. pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos { // The number of extra bytes due to multibyte chars in the `SourceFile`.