diff --git a/Formula/cbmc@6.3.1.rb b/Formula/cbmc@6.3.1.rb new file mode 100644 index 0000000..5e4ce35 --- /dev/null +++ b/Formula/cbmc@6.3.1.rb @@ -0,0 +1,49 @@ +class CbmcAT631 < Formula + desc "C Bounded Model Checker" + homepage "https://www.cprover.org/cbmc/" + url "https://github.com/diffblue/cbmc.git", + tag: "cbmc-6.3.1", + revision: "cbmc-d2b4455a109383562735cfb8b52ed8a6d2b6e197" + license "BSD-4-Clause" + + bottle do + root_url "https://github.com/diffblue/homebrew-cbmc/releases/download/bag-of-goodies" + sha256 cellar: :any_skip_relocation, arm64_sonoma: "595c9fd280844670008b35d7b9866175de39a40020849b8eb4fa3875a6b792d3" + sha256 cellar: :any_skip_relocation, arm64_ventura: "44f0bc3172d42fe36909fee2dadcef87c2f7dfa8ad359b6c9773ef6652204b3e" + sha256 cellar: :any_skip_relocation, sonoma: "758d9bb3e20a3c6e300234beb956c14760cb9c0a42ad609d1017bccc598430ff" + sha256 cellar: :any_skip_relocation, ventura: "83d43e155d6f9bff69e684456f45a8a1b54739a4f02fb053c9b83f6a82fd1acb" + sha256 cellar: :any_skip_relocation, x86_64_linux: "341911d11fb56cdc9e88c00157b1751fb13a026a154a2acff1c09ec0a4542d11" + end + + depends_on "cmake" => :build + depends_on "maven" => :build + depends_on "openjdk" => :build + depends_on "rust" => :build + + uses_from_macos "bison" => :build + uses_from_macos "flex" => :build + + fails_with gcc: "5" + + def install + system "cmake", "-S", ".", "-B", "build", "-Dsat_impl=minisat2;cadical", *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" + + # lib contains only `jar` files + libexec.install lib + end + + test do + # Find a pointer out of bounds error + (testpath/"main.c").write <<~EOS + #include + int main() { + char *ptr = malloc(10); + char c = ptr[10]; + } + EOS + assert_match "VERIFICATION FAILED", + shell_output("#{bin}/cbmc --pointer-check main.c", 10) + end +end