Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 794 Bytes

26_exercises.md

File metadata and controls

58 lines (41 loc) · 794 Bytes

< Back

26. Tools

Exercise 260

UndefinedBehaviorSanitizer (UBSan)

Experiment on Compiler Explorer.

int div(int a, int b) {
    return a / b;
}

int main () {
    int a = 42;
    int b = 0;
    return div(a, b);
}

Exercise 261

AddressSanitizer (ASan)

Experiment on Compiler Explorer.

#include <array>

int main() {
    std::array v{1, 2, 3};
    return v[4];
}

Exercise 262

MemorySanitizer (MSan)

Experiment on Compiler Explorer.

int main() {
   int a;
   return a;
}