badPool.m 692 B

12345678910111213141516171819202122232425262728293031323334
  1. // TEST_CONFIG MEM=mrc
  2. // TEST_CRASHES
  3. // Test badPoolCompat also uses this file.
  4. /*
  5. TEST_RUN_OUTPUT
  6. objc\[\d+\]: [Ii]nvalid or prematurely-freed autorelease pool 0x[0-9a-fA-F]+\.?
  7. objc\[\d+\]: HALTED
  8. END
  9. */
  10. #include "test.h"
  11. int main()
  12. {
  13. void *outer = objc_autoreleasePoolPush();
  14. void *inner = objc_autoreleasePoolPush();
  15. objc_autoreleasePoolPop(outer);
  16. objc_autoreleasePoolPop(inner);
  17. #if !OLD
  18. fail("should have crashed already with new SDK");
  19. #else
  20. // should only warn once
  21. outer = objc_autoreleasePoolPush();
  22. inner = objc_autoreleasePoolPush();
  23. objc_autoreleasePoolPop(outer);
  24. objc_autoreleasePoolPop(inner);
  25. succeed(__FILE__);
  26. #endif
  27. }