// This file is part of the SV-Benchmarks collection of verification tasks: // https://github.com/sosy-lab/sv-benchmarks // // SPDX-FileCopyrightText: 2011-2020 The SV-Benchmarks community // SPDX-FileCopyrightText: The CSeq project // // SPDX-License-Identifier: Apache-2.0 extern void abort(void); #include void reach_error() { assert(0); } #include #include #include void __VERIFIER_assert(int expression) { if (!expression) { ERROR: {reach_error();abort();}}; return; } char *v; void *thread1(void * arg) { v = malloc(sizeof(char) * 8); return 0; } void *thread2(void *arg) { if (v) strcpy(v, "Bigshot"); return 0; } int main() { pthread_t t1, t2; pthread_create(&t1, 0, thread1, 0); pthread_join(t1, 0); pthread_create(&t2, 0, thread2, 0); pthread_join(t2, 0); __VERIFIER_assert(v[0] == 'B'); // <---- wrong, malloc() can fail and therefore no strcpy! Competition's rule: malloc() never fails, thus it is safe. return 0; }