Files
carbon-lang/explorer/testdata/limits/fail_allocate.carbon
T
Richard SmithandJon Ross-Perkins ea60e4f491 Track the file kind on SourceLocation rather than computing it from the file name. (#2999)
This will be more correct if a user file is named prelude.carbon, and
reduces the explorer runtime by about 10% by removing a string
comparison from the check for whether trace output is enabled.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2023-07-19 23:07:53 +00:00

20 lines
747 B
Plaintext

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