fail_allocate.carbon 721 B

12345678910111213141516171819
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // CHECK:STDERR: RUNTIME ERROR: overflow:1: possible infinite loop: too many interpreter steps executed
  7. package EmptyIdentifier impl;
  8. fn Main() -> i32 {
  9. while (true) {
  10. // Ideally we would hit an OOM here, but it's too difficult to OOM from heap
  11. // allocations before hitting max steps. Maybe with string operations we
  12. // could trigger actual excessive memory allocations by just doubling the
  13. // size of the string each time.
  14. heap.New((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0));
  15. }
  16. return 0;
  17. }