Skip to content

Instantly share code, notes, and snippets.

@mertyildiran
Last active January 12, 2021 03:20
Show Gist options
  • Save mertyildiran/584f51cb7183c34b46e98a7020641bbe to your computer and use it in GitHub Desktop.
Save mertyildiran/584f51cb7183c34b46e98a7020641bbe to your computer and use it in GitHub Desktop.
num def f1()
num a = 101
return a
end
num def f2()
num b = 102
return b
end
num def f3()
num c = 103
return c
end
num def f4(num x, num y)
num z = x + y
bool a = true
end {
z > 5 : break,
z == 8 : f1(),
z > 10 : f2(),
default : f3()
}
list a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
void def f6(num list a)
foreach a as el
print f4(el, 1)
end
end
f6(a)
#!/bin/bash
# related code https://github.com/chaos-lang/chaos/blob/issue/corruption/interpreter/symbol.c#L120-L155
git clone -b issue/corruption https://github.com/chaos-lang/chaos.git --depth 1 && \
cd chaos && \
make clang-dev-sanitizer-memory && \
make clang && \
sudo make install && \
make test && \
chaos dev.kaos
==463398==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x4ecffe in removeChildrenOfComplex /home/mertyildiran/Documents/chaos/interpreter/symbol.c:1486:32
#1 0x4ecb8e in removeSymbol /home/mertyildiran/Documents/chaos/interpreter/symbol.c:124:5
#2 0x4d630a in executeDecision /home/mertyildiran/Documents/chaos/interpreter/function.c:810:13
#3 0x4d5b62 in callFunctionCleanUp /home/mertyildiran/Documents/chaos/interpreter/function.c:327:9
#4 0x4e6af9 in eval_node_after_function_call /home/mertyildiran/Documents/chaos/interpreter/interpreter.c:1535:5
#5 0x4dd42a in eval_node /home/mertyildiran/Documents/chaos/interpreter/interpreter.c:351:34
#6 0x4e85da in startForeach /home/mertyildiran/Documents/chaos/interpreter/loop.c:107:12
#7 0x4e47f4 in eval_node /home/mertyildiran/Documents/chaos/interpreter/interpreter.c:377:20
#8 0x4db6fc in interpret /home/mertyildiran/Documents/chaos/interpreter/interpreter.c:89:9
#9 0x4bb421 in initParser /home/mertyildiran/Documents/chaos/parser/parser.c:201:17
#10 0x4b32f3 in main /home/mertyildiran/Documents/chaos/parser/parser.y:951:5
#11 0x7ff001c970b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16
#12 0x41c49d in _start (/usr/local/bin/chaos+0x41c49d)
Uninitialized value was created by a heap deallocation
#0 0x4228b9 in free (/usr/local/bin/chaos+0x4228b9)
#1 0x4ed17b in freeSymbol /home/mertyildiran/Documents/chaos/interpreter/symbol.c:154:5
SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/mertyildiran/Documents/chaos/interpreter/symbol.c:1486:32 in removeChildrenOfComplex
Exiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment