From 1b8b27fb6be18ccc2c247d6b604b66a3b986fa7b Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 11 Apr 2014 19:52:53 -0600 Subject: [PATCH] add expect call to ensure tryAllocateExecutable actually succeeds For some reason, running Avian under the SVN version of Valgrind caused mmap to fail, which caused tryAllocateExecutable to return a null pointer, which led to a non-obvious crash later on. Adding an expect to check the result immediately will at least make it obvious what went wrong. --- src/compile.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compile.cpp b/src/compile.cpp index b974567f4b..0a62a57483 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -9095,6 +9095,9 @@ class MyProcessor: public Processor { if (codeAllocator.memory.begin() == 0) { codeAllocator.memory.items = static_cast( s->tryAllocateExecutable(ExecutableAreaSizeInBytes)); + + expect(t, codeAllocator.memory.items); + codeAllocator.memory.count = ExecutableAreaSizeInBytes; } #endif