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#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
Odin
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
Vyper
WASM
Zig
Javascript
GIMPLE
Ygen
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 19.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 19.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 19.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 = 'reduced.c' source_filename = "reduced.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @.src = private unnamed_addr constant [10 x i8] c"reduced.c\00", align 1 @0 = private unnamed_addr global { { [10 x i8]*, i32, i32 } } { { [10 x i8]*, i32, i32 } { [10 x i8]* @.src, i32 2, i32 21 } } @a = common global i8 0, align 1 @1 = private unnamed_addr global { { [10 x i8]*, i32, i32 } } { { [10 x i8]*, i32, i32 } { [10 x i8]* @.src, i32 5, i32 18 } } @2 = private unnamed_addr global { { [10 x i8]*, i32, i32 } } { { [10 x i8]*, i32, i32 } { [10 x i8]* @.src, i32 5, i32 40 } } ; Function Attrs: noreturn nounwind uwtable declare void @__ubsan_handle_pointer_overflow_abort(i8*, i64, i64) local_unnamed_addr #1 ; Function Attrs: nounwind define void @h() #0 { ret void } ; Function Attrs: argmemonly nounwind willreturn declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #2 ; Function Attrs: nounwind define internal fastcc void @d(i8* %c) unnamed_addr #0 { entry: %cmp = icmp ule i8* %c, getelementptr inbounds (i8, i8* @a, i64 65535) %add.ptr = getelementptr inbounds i8, i8* %c, i64 -65535 %0 = ptrtoint i8* %c to i64 %1 = add i64 %0, -65535 %2 = icmp ne i64 %1, 0 %3 = icmp ugt i8* %c, inttoptr (i64 65534 to i8*) %4 = and i1 %3, %2 br label %while.cond while.cond: ; preds = %switch.early.test.i, %entry br i1 icmp ne (i32 ptrtoint (void ()* @h to i32), i32 0), label %while.body, label %while.end while.body: ; preds = %while.cond br i1 icmp ne (i64 add (i64 ptrtoint (i8* @a to i64), i64 65535), i64 0), label %cont, label %handler.pointer_overflow, !prof !3, !nosanitize !2 handler.pointer_overflow: ; preds = %while.body call void @__ubsan_handle_pointer_overflow_abort(i8* bitcast ({ { [10 x i8]*, i32, i32 } }* @1 to i8*), i64 ptrtoint (i8* @a to i64), i64 add (i64 ptrtoint (i8* @a to i64), i64 65535)) #3, !nosanitize !2 unreachable, !nosanitize !2 cont: ; preds = %while.body %brmerge = or i1 %cmp, %4 %a.mux = select i1 %cmp, i8* @a, i8* %add.ptr, !prof !4 br i1 %brmerge, label %cond.end, label %handler.pointer_overflow1, !prof !5 handler.pointer_overflow1: ; preds = %cont %5 = ptrtoint i8* %c to i64, !nosanitize !2 call void @__ubsan_handle_pointer_overflow_abort(i8* bitcast ({ { [10 x i8]*, i32, i32 } }* @2 to i8*), i64 %5, i64 %1) #3, !nosanitize !2 unreachable, !nosanitize !2 cond.end: ; preds = %cont %6 = ptrtoint i8* %a.mux to i64, !nosanitize !2 %7 = add i64 %6, 1, !nosanitize !2 %8 = icmp eq i64 %7, 0, !nosanitize !2 br i1 %8, label %handler.pointer_overflow.i, label %switch.early.test.i switch.early.test.i: ; preds = %cond.end switch i64 %6, label %while.cond [ i64 -1, label %handler.pointer_overflow.i i64 0, label %handler.pointer_overflow.i ] handler.pointer_overflow.i: ; preds = %switch.early.test.i, %switch.early.test.i, %cond.end %.lcssa = phi i64 [ %7, %switch.early.test.i ], [ %7, %switch.early.test.i ], [ %7, %cond.end ] %a.mux.lcssa4 = phi i8* [ %a.mux, %switch.early.test.i ], [ %a.mux, %switch.early.test.i ], [ %a.mux, %cond.end ] %9 = ptrtoint i8* %a.mux.lcssa4 to i64, !nosanitize !2 call void @__ubsan_handle_pointer_overflow_abort(i8* bitcast ({ { [10 x i8]*, i32, i32 } }* @0 to i8*), i64 %9, i64 %.lcssa) #3, !nosanitize !2 unreachable, !nosanitize !2 while.end: ; preds = %while.cond ret void } attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { noreturn nounwind uwtable } attributes #2 = { argmemonly nounwind willreturn } attributes #3 = { noreturn nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0} !llvm.ident = !{!1} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28)"} !2 = !{} !3 = !{!"branch_weights", i32 1048575, i32 1} !4 = !{!"branch_weights", i32 1048576, i32 1048575} !5 = !{!"branch_weights", i32 2097151, 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
CE on Bluesky
About the author
Statistics
Changelog
Version tree