Skip to content

Commit 1d064f1

Browse files
authored
Disable strict aliasing (rust-lang#104)
1 parent 863cfb2 commit 1d064f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/base.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol) -> (Modul
7777
for arg in &tcx.sess.opts.cg.llvm_args {
7878
context.add_command_line_option(arg);
7979
}
80+
// NOTE: an optimization (https://github.com/rust-lang/rustc_codegen_gcc/issues/53).
8081
context.add_command_line_option("-fno-semantic-interposition");
82+
// NOTE: Rust relies on LLVM not doing TBAA (https://github.com/rust-lang/unsafe-code-guidelines/issues/292).
83+
context.add_command_line_option("-fno-strict-aliasing");
8184
if env::var("CG_GCCJIT_DUMP_CODE").as_deref() == Ok("1") {
8285
context.set_dump_code_on_compile(true);
8386
}

0 commit comments

Comments
 (0)