{"id":22530053,"url":"https://github.com/marxin/cvise","last_synced_at":"2025-05-16T08:06:33.491Z","repository":{"id":38346972,"uuid":"256755439","full_name":"marxin/cvise","owner":"marxin","description":"Super-parallel Python port of the C-Reduce","archived":false,"fork":false,"pushed_at":"2025-04-03T19:13:56.000Z","size":5015,"stargazers_count":281,"open_issues_count":28,"forks_count":28,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-15T20:15:00.897Z","etag":null,"topics":["clang","comparison","crashes","developer-tools","gcc","parallel","reduction"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marxin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-18T13:04:05.000Z","updated_at":"2025-05-09T06:09:20.000Z","dependencies_parsed_at":"2023-12-13T05:24:02.604Z","dependency_job_id":"32f622aa-24ec-49ea-a3f5-968ed6f17f6a","html_url":"https://github.com/marxin/cvise","commit_stats":{"total_commits":2525,"total_committers":37,"mean_commits":68.24324324324324,"dds":0.6071287128712871,"last_synced_commit":"1997a703cdc1a1f9a5ca9c99cfa6536ae55186a6"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marxin%2Fcvise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marxin%2Fcvise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marxin%2Fcvise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marxin%2Fcvise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marxin","download_url":"https://codeload.github.com/marxin/cvise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493378,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clang","comparison","crashes","developer-tools","gcc","parallel","reduction"],"created_at":"2024-12-07T07:18:00.742Z","updated_at":"2025-05-16T08:06:28.482Z","avatar_url":"https://github.com/marxin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C-Vise\n\n[![Build](https://github.com/marxin/cvise/actions/workflows/build.yml/badge.svg)](https://github.com/marxin/cvise/actions/workflows/build.yml)\n[![Build LLVM nightly](https://github.com/marxin/cvise/actions/workflows/build-llvm-nightly.yml/badge.svg)](https://github.com/marxin/cvise/actions/workflows/build-llvm-nightly.yml)\n\n## About \n\nC-Vise is a super-parallel Python port of the [C-Reduce](https://github.com/csmith-project/creduce/).\nThe port is fully compatible to the C-Reduce and uses the same efficient\nLLVM-based C/C++ reduction tool named `clang_delta`.\n\n**This project is looking for maintainers — reach out to [@marxin] if you're interested.**\n\nC-Vise is a tool that takes a large C, C++ or OpenCL program that\nhas a property of interest (such as triggering a compiler bug) and\nautomatically produces a much smaller C/C++ or OpenCL program that has\nthe same property.  It is intended for use by people who discover and\nreport bugs in compilers and other tools that process C/C++ or OpenCL\ncode.\n\nThe project also contains a simple wrapper `cvise-delta` which simulates\nthe same behavior as original [delta](http://delta.tigris.org/) tool\n(but in super-parallel way).\n\n*NOTE*: C-Vise happens to do a pretty good job reducing the size of\nprograms in languages other than C/C++, such as JavaScript and Rust.\nIf you need to reduce programs in some other language, please give it\na try.\n\n*NOTE*: Binary pass group (`--pass-group=binary`) contains an experimental pass\nthat can reduce GCC's `.gcda` files.\n\n## Speed Comparison\n\nI made a comparison for couple of GCC bug reports on my AMD Ryzen 7 2700X Eight-Core Processor\nmachine with the following results:\n\n| Test-case | Size | C-Vise Reduction | C-Reduce Reduction | Speed Up |\n| --- | --- | --- | --- | --- |\n| [PR92516](http://gcc.gnu.org/PR92516) | 6.5 MB | 35m | 77m | 220% |\n| [PR94523](http://gcc.gnu.org/PR94523) | 2.1 MB | 15m | 33m | 220% |\n| [PR94632](http://gcc.gnu.org/PR94632) | 3.3 MB | 20m | 28m | 40% |\n| [PR94937](http://gcc.gnu.org/PR94937) | 8.5 MB | 242m | 303m | 125% |\n\n## Installation\n\nSee [INSTALL.md](INSTALL.md).\n\n## Usage example\n\nThe C-Vise can be used for a reduction of a compiler crash. In this case,\nlet's consider an existing [PR94534](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94534):\n\nOriginal test-case (`pr94534.C` file):\n```c++\ntemplate\u003ctypename T\u003e\nclass Demo\n{\n  struct\n  {\n    Demo* p;\n  } payload{this};\n  friend decltype(payload);\n};\n\nint main()\n{\n  Demo\u003cint\u003e d;\n}\n```\n\nThe program crashes in GCC, but is accepted with Clang:\n```console\n$ g++ pr94534.C -c\npr94534.C: In instantiation of ‘class Demo\u003cint\u003e’:\npr94534.C:13:13:   required from here\npr94534.C:7:5: internal compiler error: Segmentation fault\n    7 |   } payload{this};\n      |     ^~~~~~~\n0x10a1d8f crash_signal\n\t/home/marxin/Programming/gcc/gcc/toplev.c:328\n0x7ffff78fef1f ???\n\t/usr/src/debug/glibc-2.31-4.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0\n0xae31a8 instantiate_class_template_1\n\t/home/marxin/Programming/gcc/gcc/cp/pt.c:11973\n...\n$ clang++ pr94534.C -c\n```\n\nSo let's build a reduction script so that it will grep for `instantiate_class_template_1`\non the standard error output and that it compiles with Clang:\n\n`reduce-ice.sh`:\n```shell\n#!/bin/sh\ng++ pr94534.C -c 2\u003e\u00261 | grep 'instantiate_class_template_1' \u0026\u0026 clang++ -c pr94534.C\n```\n\nThe reduction can be then run with:\n```console\n$ cvise ./reduce-ice.sh pr94534.C\nINFO ===\u003c 30356 \u003e===\nINFO running 16 interestingness tests in parallel\nINFO INITIAL PASSES\nINFO ===\u003c IncludesPass \u003e===\n...\ntemplate \u003ctypename\u003e class a {\n  int b;\n  friend decltype(b);\n};\nvoid c() { a\u003cint\u003e d; }\n```\n\n## Notes\n\n1. C-Vise creates temporary directories in `$TMPDIR` and so usage\nof a `tmpfs` directory is recommended.\n\n1. Each invocation of the interestingness test is performed in a fresh\ntemporary directory containing a copy of the file that is being\nreduced. If your interestingness test requires access to other files,\nyou should either copy them into the current working directory or else\nrefer to them using an absolute path.\n\n1. If you copy the compiler invocation line from your build tool, remove\n-Werror if present. Some C-Vise passes introduce warnings, so -Werror\nwill make those passes ineffective.\n\n   Doing that, a reduction will typically end up faster, however,\n   one may end up with a code snippet full of warnings that needs\n   to be addresses after the reduction.\n\n1. Adding `-Wfatal-errors` to the interestingness test can speed up\n   large reductions by causing the compiler to bail out quickly on errors,\n   rather than trying to soldier on producing a result that is eventually\n   discarded.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarxin%2Fcvise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarxin%2Fcvise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarxin%2Fcvise/lists"}