All Projects → marxin → Cvise

marxin / Cvise

Licence: other
Super-parallel Python port of the C-Reduce

Projects that are alternatives of or similar to Cvise

cpp-compiler-options
Compilation options for different versions of Clang, GCC and MSVC. Provided a generator and different file formats (cmake, xmake, meson, premake5, bjam/b2, ...)
Stars: ✭ 19 (-75.32%)
Mutual labels:  gcc, clang
Usrefl
Header-only, tiny (99 lines) and powerful C++20 static reflection library.
Stars: ✭ 287 (+272.73%)
Mutual labels:  clang, gcc
hmg
💝 My personal Gentoo/Linux configuration backup files
Stars: ✭ 16 (-79.22%)
Mutual labels:  gcc, clang
ci playground
Playground for Cloud CI development for C++
Stars: ✭ 23 (-70.13%)
Mutual labels:  gcc, clang
Pfr
std::tuple like methods for user defined types without any macro or boilerplate code
Stars: ✭ 896 (+1063.64%)
Mutual labels:  clang, gcc
cdetect
🔬 Detect which compiler and compiler version a Linux executable (in the ELF format) was compiled with
Stars: ✭ 23 (-70.13%)
Mutual labels:  gcc, clang
Boomerang
Boomerang Decompiler - Fighting the code-rot :)
Stars: ✭ 265 (+244.16%)
Mutual labels:  clang, gcc
minilib
A c standard system library with a focus on size, headeronly, "singlefile", intended for static linking. 187 Bytes for "Hello World"(regular elf), compiled with the standard gcc toolchain.
Stars: ✭ 29 (-62.34%)
Mutual labels:  gcc, clang
Croaring
Roaring bitmaps in C (and C++)
Stars: ✭ 735 (+854.55%)
Mutual labels:  clang, gcc
Gcovr
generate code coverage reports with gcc/gcov
Stars: ✭ 482 (+525.97%)
Mutual labels:  clang, gcc
rebuild
Zero-dependency, reproducible build environments
Stars: ✭ 48 (-37.66%)
Mutual labels:  gcc, clang
Avalonstudio
Cross platform IDE and Shell
Stars: ✭ 1,132 (+1370.13%)
Mutual labels:  clang, gcc
open-ops
Open Optimizing Parallelizing System
Stars: ✭ 21 (-72.73%)
Mutual labels:  parallel, clang
lldbg
A lightweight native GUI for LLDB.
Stars: ✭ 83 (+7.79%)
Mutual labels:  gcc, clang
c-compiler-security
Security-related flags and options for C compilers
Stars: ✭ 125 (+62.34%)
Mutual labels:  gcc, clang
rooki
A stupid simple script runner supporting c, c++, rust, haskell and virtually anything
Stars: ✭ 26 (-66.23%)
Mutual labels:  gcc, clang
perses
Language-agnostic program reducer.
Stars: ✭ 57 (-25.97%)
Mutual labels:  gcc, clang
C-Cpp-Coverage-for-CLion
Get coverage data in CLion using gcov or llvm-cov
Stars: ✭ 37 (-51.95%)
Mutual labels:  gcc, clang
Ci helloworld
A simple example of how to setup a complete CI environment for C and C++
Stars: ✭ 357 (+363.64%)
Mutual labels:  clang, gcc
C2goasm
C to Go Assembly
Stars: ✭ 1,072 (+1292.21%)
Mutual labels:  clang, gcc

C-Vise

OBS master GitHub Actions Total alerts Language grade: Python Language grade: C/C++ codecov

About

C-Vise is a super-parallel Python port of the C-Reduce. The port is fully compatible to the C-Reduce and uses the same efficient LLVM-based C/C++ reduction tool named clang_delta.

C-Vise is a tool that takes a large C, C++ or OpenCL program that has a property of interest (such as triggering a compiler bug) and automatically produces a much smaller C/C++ or OpenCL program that has the same property. It is intended for use by people who discover and report bugs in compilers and other tools that process C/C++ or OpenCL code.

The project also contains a simple wrapper cvise-delta which simulates the same behavior as original delta tool (but in super-parallel way).

NOTE: C-Vise happens to do a pretty good job reducing the size of programs in languages other than C/C++, such as JavaScript and Rust. If you need to reduce programs in some other language, please give it a try.

NOTE:: Binary pass group (--pass-group=binary) contains an experimental pass that can reduce GCC's .gcda files.

Speed Comparison

I made a comparison for couple of GCC bug reports on my AMD Ryzen 7 2700X Eight-Core Processor machine with the following results:

Test-case Size C-Vise Reduction C-Reduce Reduction Speed Up
PR92516 6.5 MB 35m 77m 220%
PR94523 2.1 MB 15m 33m 220%
PR94632 3.3 MB 20m 28m 40%
PR94937 8.5 MB 242m 303m 125%

Installation

See INSTALL.md.

Usage example

The C-Vise can be used for a reduction of a compiler crash. In this case, let's consider an existing PR94534:

Original test-case (pr94534.C file):

template<typename T>
class Demo
{
  struct
  {
    Demo* p;
  } payload{this};
  friend decltype(payload);
};

int main()
{
  Demo<int> d;
}

The program crashes in GCC, but is accepted with Clang:

$ g++ pr94534.C -c
pr94534.C: In instantiation of ‘class Demo<int>’:
pr94534.C:13:13:   required from here
pr94534.C:7:5: internal compiler error: Segmentation fault
    7 |   } payload{this};
      |     ^~~~~~~
0x10a1d8f crash_signal
	/home/marxin/Programming/gcc/gcc/toplev.c:328
0x7ffff78fef1f ???
	/usr/src/debug/glibc-2.31-4.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0xae31a8 instantiate_class_template_1
	/home/marxin/Programming/gcc/gcc/cp/pt.c:11973
...
$ clang++ pr94534.C -c

So let's build a reduction script so that it will grep for instantiate_class_template_1 on the standard error output and that it compiles with Clang:

reduce-ice.sh:

#!/bin/sh
g++ pr94534.C -c 2>&1 | grep 'instantiate_class_template_1' && clang++ -c pr94534.C

The reduction can be then run with:

$ cvise ./reduce-ice.sh pr94534.C
INFO ===< 30356 >===
INFO running 16 interestingness tests in parallel
INFO INITIAL PASSES
INFO ===< IncludesPass >===
...
template <typename> class a {
  int b;
  friend decltype(b);
};
void c() { a<int> d; }

Notes

  1. C-Vise creates temporary directories in $TMPDIR and so usage of a tmpfs directory is recommended.

  2. Each invocation of the interestingness test is performed in a fresh temporary directory containing a copy of the file that is being reduced. If your interestingness test requires access to other files, you should either copy them into the current working directory or else refer to them using an absolute path.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].