Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
Go
Haskell
HLSL
Hook
Hylo
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
Zig
Javascript
GIMPLE
llvm source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
clang (assertions trunk)
clang (trunk)
clang 10.0.0
clang 10.0.1
clang 11.0.0
clang 11.0.1
clang 12.0.0
clang 12.0.1
clang 13.0.0
clang 14.0.0
clang 15.0.0
clang 16.0.0
clang 17.0.1
clang 18.1.0
clang 4.0.1
clang 5.0.0
clang 6.0.0
clang 7.0.0
clang 8.0.0
clang 9.0.0
llc (assertions trunk)
llc (trunk)
llc 10.0.0
llc 10.0.1
llc 11.0.0
llc 11.0.1
llc 12.0.0
llc 12.0.1
llc 13.0.0
llc 14.0.0
llc 15.0.0
llc 16.0.0
llc 17.0.1
llc 18.1.0
llc 3.2
llc 3.3
llc 3.9.1
llc 4.0.0
llc 4.0.1
llc 5.0.0
llc 6.0.0
llc 7.0.0
llc 8.0.0
llc 9.0.0
opt (assertions trunk)
opt (trunk)
opt 10.0.0
opt 10.0.1
opt 11.0.0
opt 11.0.1
opt 12.0.0
opt 12.0.1
opt 13.0.0
opt 14.0.0
opt 15.0.0
opt 16.0.0
opt 17.0.1
opt 18.1.0
opt 3.2
opt 3.3
opt 3.9.1
opt 4.0.0
opt 4.0.1
opt 5.0.0
opt 6.0.0
opt 7.0.0
opt 8.0.0
opt 9.0.0
Options
Source code
; ModuleID = 'test/CodeGen/catch-implicit-conversions-basics.c' source_filename = "test/CodeGen/catch-implicit-conversions-basics.c" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @.src = private unnamed_addr constant [49 x i8] c"test/CodeGen/catch-implicit-conversions-basics.c\00", align 1 @0 = private unnamed_addr constant { i16, i16, [15 x i8] } { i16 0, i16 10, [15 x i8] c"'unsigned int'\00" } @1 = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" } @2 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [15 x i8] }*, { i16, i16, [6 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 900, i32 10 }, { i16, i16, [15 x i8] }* @0, { i16, i16, [6 x i8] }* @1, i8 3 } @3 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [15 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1000, i32 10 }, { i16, i16, [6 x i8] }* @1, { i16, i16, [15 x i8] }* @0, i8 3 } @4 = private unnamed_addr constant { i16, i16, [16 x i8] } { i16 0, i16 6, [16 x i8] c"'unsigned char'\00" } @5 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [16 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1100, i32 10 }, { i16, i16, [6 x i8] }* @1, { i16, i16, [16 x i8] }* @4, i8 3 } @6 = private unnamed_addr constant { i16, i16, [14 x i8] } { i16 0, i16 7, [14 x i8] c"'signed char'\00" } @7 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [14 x i8] }*, { i16, i16, [16 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1200, i32 10 }, { i16, i16, [14 x i8] }* @6, { i16, i16, [16 x i8] }* @4, i8 3 } @8 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [16 x i8] }*, { i16, i16, [14 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1300, i32 10 }, { i16, i16, [16 x i8] }* @4, { i16, i16, [14 x i8] }* @6, i8 3 } @9 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [14 x i8] }*, { i16, i16, [15 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1400, i32 10 }, { i16, i16, [14 x i8] }* @6, { i16, i16, [15 x i8] }* @0, i8 3 } @10 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [15 x i8] }*, { i16, i16, [14 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1500, i32 10 }, { i16, i16, [15 x i8] }* @0, { i16, i16, [14 x i8] }* @6, i8 3 } @11 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [14 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1600, i32 10 }, { i16, i16, [6 x i8] }* @1, { i16, i16, [14 x i8] }* @6, i8 3 } ; Function Attrs: noinline nounwind uwtable define dso_local i32 @convert_unsigned_int_to_signed_int(i32 %x) #0 { entry: %x.addr = alloca i32, align 4 store i32 %x, i32* %x.addr, align 4 %0 = load i32, i32* %x.addr, align 4 %src..negativitycheck = icmp ult i32 %0, 0, !nosanitize !2 %dst..negativitycheck = icmp slt i32 %0, 0, !nosanitize !2 %signchangecheck = icmp eq i1 %src..negativitycheck, %dst..negativitycheck, !nosanitize !2 br i1 %signchangecheck, label %cont, label %handler.implicit_conversion, !prof !3, !nosanitize !2 handler.implicit_conversion: ; preds = %entry %1 = zext i32 %0 to i64, !nosanitize !2 %2 = zext i32 %0 to i64, !nosanitize !2 call void @__ubsan_handle_implicit_conversion(i8* bitcast ({ { [49 x i8]*, i32, i32 }, { i16, i16, [15 x i8] }*, { i16, i16, [6 x i8] }*, i8 }* @2 to i8*), i64 %1, i64 %2) #2, !nosanitize !2 br label %cont, !nosanitize !2 cont: ; preds = %handler.implicit_conversion, %entry ret i32 %0 } ; Function Attrs: uwtable declare dso_local void @__ubsan_handle_implicit_conversion(i8*, i64, i64) #1 attributes #0 = { noinline nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { uwtable } attributes #2 = { nounwind } !llvm.module.flags = !{!0} !llvm.ident = !{!1} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{!"clang version 8.0.0 (trunk 340386) (llvm/trunk 340384)"} !2 = !{} !3 = !{!"branch_weights", i32 1048575, i32 1}
llvm source #2
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
clang (assertions trunk)
clang (trunk)
clang 10.0.0
clang 10.0.1
clang 11.0.0
clang 11.0.1
clang 12.0.0
clang 12.0.1
clang 13.0.0
clang 14.0.0
clang 15.0.0
clang 16.0.0
clang 17.0.1
clang 18.1.0
clang 4.0.1
clang 5.0.0
clang 6.0.0
clang 7.0.0
clang 8.0.0
clang 9.0.0
llc (assertions trunk)
llc (trunk)
llc 10.0.0
llc 10.0.1
llc 11.0.0
llc 11.0.1
llc 12.0.0
llc 12.0.1
llc 13.0.0
llc 14.0.0
llc 15.0.0
llc 16.0.0
llc 17.0.1
llc 18.1.0
llc 3.2
llc 3.3
llc 3.9.1
llc 4.0.0
llc 4.0.1
llc 5.0.0
llc 6.0.0
llc 7.0.0
llc 8.0.0
llc 9.0.0
opt (assertions trunk)
opt (trunk)
opt 10.0.0
opt 10.0.1
opt 11.0.0
opt 11.0.1
opt 12.0.0
opt 12.0.1
opt 13.0.0
opt 14.0.0
opt 15.0.0
opt 16.0.0
opt 17.0.1
opt 18.1.0
opt 3.2
opt 3.3
opt 3.9.1
opt 4.0.0
opt 4.0.1
opt 5.0.0
opt 6.0.0
opt 7.0.0
opt 8.0.0
opt 9.0.0
Options
Source code
; ModuleID = 'test/CodeGen/catch-implicit-conversions-basics.c' source_filename = "test/CodeGen/catch-implicit-conversions-basics.c" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @.src = private unnamed_addr constant [49 x i8] c"test/CodeGen/catch-implicit-conversions-basics.c\00", align 1 @0 = private unnamed_addr constant { i16, i16, [15 x i8] } { i16 0, i16 10, [15 x i8] c"'unsigned int'\00" } @1 = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" } @2 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [15 x i8] }*, { i16, i16, [6 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 900, i32 10 }, { i16, i16, [15 x i8] }* @0, { i16, i16, [6 x i8] }* @1, i8 3 } @3 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [15 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1000, i32 10 }, { i16, i16, [6 x i8] }* @1, { i16, i16, [15 x i8] }* @0, i8 3 } @4 = private unnamed_addr constant { i16, i16, [16 x i8] } { i16 0, i16 6, [16 x i8] c"'unsigned char'\00" } @5 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [16 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1100, i32 10 }, { i16, i16, [6 x i8] }* @1, { i16, i16, [16 x i8] }* @4, i8 3 } @6 = private unnamed_addr constant { i16, i16, [14 x i8] } { i16 0, i16 7, [14 x i8] c"'signed char'\00" } @7 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [14 x i8] }*, { i16, i16, [16 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1200, i32 10 }, { i16, i16, [14 x i8] }* @6, { i16, i16, [16 x i8] }* @4, i8 3 } @8 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [16 x i8] }*, { i16, i16, [14 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1300, i32 10 }, { i16, i16, [16 x i8] }* @4, { i16, i16, [14 x i8] }* @6, i8 3 } @9 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [14 x i8] }*, { i16, i16, [15 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1400, i32 10 }, { i16, i16, [14 x i8] }* @6, { i16, i16, [15 x i8] }* @0, i8 3 } @10 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [15 x i8] }*, { i16, i16, [14 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1500, i32 10 }, { i16, i16, [15 x i8] }* @0, { i16, i16, [14 x i8] }* @6, i8 3 } @11 = private unnamed_addr global { { [49 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [14 x i8] }*, i8 } { { [49 x i8]*, i32, i32 } { [49 x i8]* @.src, i32 1600, i32 10 }, { i16, i16, [6 x i8] }* @1, { i16, i16, [14 x i8] }* @6, i8 3 } ; Function Attrs: noinline nounwind uwtable define dso_local i32 @co2nvert_unsigned_int_to_signed_int(i32 %x) #0 { entry: %x.addr = alloca i32, align 4 store i32 %x, i32* %x.addr, align 4 %0 = load i32, i32* %x.addr, align 4 %dst..negativitycheck = icmp sgt i32 %0, -1, !nosanitize !2 br i1 %dst..negativitycheck, label %cont, label %handler.implicit_conversion, !prof !2, !nosanitize !3 handler.implicit_conversion: ; preds = %entry %1 = zext i32 %0 to i64, !nosanitize !2 %2 = zext i32 %0 to i64, !nosanitize !2 call void @__ubsan_handle_implicit_conversion(i8* bitcast ({ { [49 x i8]*, i32, i32 }, { i16, i16, [15 x i8] }*, { i16, i16, [6 x i8] }*, i8 }* @2 to i8*), i64 %1, i64 %2) #2, !nosanitize !2 br label %cont, !nosanitize !2 cont: ; preds = %handler.implicit_conversion, %entry ret i32 %0 } ; Function Attrs: uwtable declare dso_local void @__ubsan_handle_implicit_conversion(i8*, i64, i64) #1 attributes #0 = { noinline nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { uwtable } attributes #2 = { nounwind } !llvm.module.flags = !{!0} !llvm.ident = !{!1} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{!"clang version 8.0.0 (trunk 340386) (llvm/trunk 340384)"} !2 = !{} !3 = !{!"branch_weights", i32 1048575, i32 1}
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree