Skip to content

Instantly share code, notes, and snippets.

@nelhage
Created May 24, 2020 18:21
Show Gist options
  • Save nelhage/be3c7291c8af79e5fcdf6d40ebb7df98 to your computer and use it in GitHub Desktop.
Save nelhage/be3c7291c8af79e5fcdf6d40ebb7df98 to your computer and use it in GitHub Desktop.
[nelhage@monolithique:~/code/alexbench]$ clang-11 -O1 -S -c -emit-llvm overflow_2.c
[nelhage@monolithique:~/code/alexbench]$ opt-11 --opt-bisect-limit=137 -O2 -S overflow_2.ll 2>/dev/null | opt-11 -O2 -S -o overflow_2_opt.ll
[nelhage@monolithique:~/code/alexbench]$ cat overflow_2_opt.ll
; ModuleID = '<stdin>'
source_filename = "overflow_2.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-pc-linux-gnu"
; Function Attrs: nofree nounwind uwtable
define dso_local { i8*, i64 } @f1_overflow() local_unnamed_addr #0 {
%1 = tail call noalias dereferenceable_or_null(100000) i8* @malloc(i64 100000) #3
call void @llvm.memset.p0i8.i64(i8* nonnull align 1 dereferenceable(100000) %1, i8 42, i64 100000, i1 false)
%2 = insertvalue { i8*, i64 } undef, i8* %1, 0
%3 = insertvalue { i8*, i64 } %2, i64 100000, 1
ret { i8*, i64 } %3
}
; Function Attrs: nofree nounwind
declare dso_local noalias i8* @malloc(i64) local_unnamed_addr #1
; Function Attrs: argmemonly nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #2
attributes #0 = { nofree nounwind uwtable "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-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nofree nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="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"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { argmemonly nounwind willreturn writeonly }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 11.0.0-++20200513052626+1370757dd01-1~exp1~20200513153230.40 "}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment