fail_allocate.carbon 747 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. package EmptyIdentifier impl;
  7. fn Main() -> i32 {
  8. while (true) {
  9. // Ideally we would hit an OOM here, but it's too difficult to OOM from heap
  10. // allocations before hitting max steps. Maybe with string operations we
  11. // could trigger actual excessive memory allocations by just doubling the
  12. // size of the string each time.
  13. // CHECK:STDERR: RUNTIME ERROR: fail_allocate.carbon:[[@LINE+1]]: possible infinite loop: too many interpreter steps executed
  14. heap.New((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0));
  15. }
  16. return 0;
  17. }