You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

49 line
908 B

  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <iostream>
  4. class BarB
  5. {
  6. public:
  7. float y;
  8. /* Include something that uses a virtual function. The symbols
  9. that are broken on current OS X libc++ involve this */
  10. virtual int arst(int o)
  11. {
  12. return 4 + o;
  13. }
  14. };
  15. static void print_array(const int* a)
  16. {
  17. for (int i = 0; i < 4; ++i)
  18. {
  19. std::cout << a[i] << ", ";
  20. }
  21. std::cout << '\n';
  22. }
  23. /* Just include something that ubsan will need to check */
  24. int main(int argc, const char* argv[])
  25. {
  26. BarB* b = new BarB();
  27. if (argc > 1)
  28. {
  29. int uninitialized[4];
  30. //int* uninitialized = new int[4];
  31. print_array(uninitialized);
  32. //delete[] uninitialized;
  33. int x = atoi(argv[1]);
  34. std::cout << (4 / x) << '\n';
  35. fputs(argv[x], stdout);
  36. std::cout << b->arst(x) << '\n';
  37. }
  38. delete b;
  39. return 0;
  40. }