lean4-htt/tests/compile
Henrik Böving f180c9ce17
fix: handling of EmitC for small hex string literals (#13435)
This PR fixes a bug in EmitC that can be caused by working with the
string literal `"\x01abc"` in
Lean and causes a C compiler error.

The error is as follows:
```
run.c:29:189: error: hex escape sequence out of range
   29 | static const lean_string_object l_badString___closed__0_value = {.m_header = {.m_rc = 0, .m_cs_sz = 0, .m_other = 0, .m_tag = 249}, .m_size = 5, .m_capacity = 5, .m_length = 4, .m_data = "\x01abc"};
      |                                                                                                                                                                                             ^~~~~~~
1 error generated.
```
This happens as hex escape sequences can be arbitrarily long while lean
expects them to cut off
after two chars. Thus, the C compiler parses the string as one large hex
escape sequence `01abc` and
subsequently notices this is too large.

Discovered by @datokrat
2026-04-17 15:16:28 +00:00
..
534.lean
534.lean.out.expected
append.lean
append.lean.out.expected
arity_bug1.lean
arity_bug1.lean.out.expected
array.lean
array.lean.out.expected
array_test.lean
array_test.lean.out.expected
array_test2.lean
arrayMk.lean
arrayMk.lean.out.expected
bigctor.lean
bigctor.lean.out.expected
bytearray_bug.lean
bytearray_bug.lean.out.expected
char_escape.lean fix: handling of EmitC for small hex string literals (#13435) 2026-04-17 15:16:28 +00:00
char_escape.lean.out.expected fix: handling of EmitC for small hex string literals (#13435) 2026-04-17 15:16:28 +00:00
closure_bug1.lean
closure_bug1.lean.out.expected
closure_bug2.lean
closure_bug2.lean.out.expected
closure_bug3.lean
closure_bug3.lean.out.expected
closure_bug4.lean
closure_bug4.lean.out.expected
closure_bug5.lean
closure_bug5.lean.out.expected
closure_bug6.lean
closure_bug6.lean.out.expected
closure_bug7.lean
closure_bug7.lean.out.expected
closure_bug8.lean
closure_bug8.lean.out.expected
escape.lean
escape.lean.out.expected
expr.lean
expr.lean.out.expected
extractClosedMutualBlock.lean
extractClosedMutualBlock.lean.out.expected
file_read_overflow.lean fix: file read buffer overflow (#13392) 2026-04-13 17:56:27 +00:00
float.lean
float.lean.out.expected
float_cases_bug.lean
float_cases_bug.lean.out.expected
init.lean
init.lean.no_interpret
init.lean.out.expected
initUnboxed.lean
initUnboxed.lean.no_interpret
initUnboxed.lean.out.expected
large_closure_bug.lean feat: add instance validation checks in addInstance (#13389) 2026-04-16 17:48:16 +00:00
large_closure_bug.lean.out.expected
lazylist.lean
lazylist.lean.no_interpret
lazylist.lean.out.expected
link_lake.lean
map_big.lean
map_big.lean.no_interpret
map_big.lean.out.expected
module.lean
module.lean.out.expected
nat_shiftr.lean
nat_shiftr.lean.out.expected
overflow1.lean
overflow1.lean.out.expected
overflow2.lean
overflow2.lean.out.expected
overflow3.lean
overflow3.lean.out.expected
partial.lean
partial.lean.out.expected
phashmap.lean
phashmap.lean.out.expected
phashmap2.lean
phashmap2.lean.out.expected
phashmap3.lean
phashmap3.lean.out.expected
print_error.lean
print_error.lean.init.sh chore: migrate pkg tests (#12889) 2026-03-11 18:55:46 +00:00
print_error.lean.out.expected
qsortBadLt.lean
qsortBadLt.lean.out.expected
rbmap_library.lean
rbmap_library.lean.out.expected
reduceArity_overapp.lean
reduceArity_overapp.lean.out.expected
reusebug.lean
reusebug.lean.out.expected
run_bench.sh chore: fixes from #13103 "enable separate codegen" (#13241) 2026-04-02 11:13:22 +00:00
run_test.sh chore: fixes from #13103 "enable separate codegen" (#13241) 2026-04-02 11:13:22 +00:00
StackOverflow.lean
StackOverflow.lean.init.sh chore: migrate pkg tests (#12889) 2026-03-11 18:55:46 +00:00
StackOverflow.lean.no_interpret
StackOverflow.lean.out.expected
StackOverflowTask.lean
StackOverflowTask.lean.init.sh chore: migrate pkg tests (#12889) 2026-03-11 18:55:46 +00:00
StackOverflowTask.lean.no_interpret
StackOverflowTask.lean.out.expected
str.lean
str.lean.out.expected
strictAndOr.lean
strictAndOr.lean.out.expected
t1.lean
t1.lean.out.expected
t2.lean
t2.lean.out.expected
t4.lean
t4.lean.out.expected
thunk.lean
thunk.lean.out.expected
trie.lean
trie.lean.out.expected
trigraphs.lean
trigraphs.lean.out.expected
tuple.lean
tuple.lean.out.expected
typeFormerPolymorphism.lean
typeFormerPolymorphism.lean.out.expected
uint_fold.lean
uint_fold.lean.out.expected
unreachable.lean
uset.lean
uset.lean.out.expected
utf8Path.lean
utf8Path.lean.英語
wait_dedicated.lean
wait_dedicated.lean.out.expected