[LLVMbugs] [Bug 15503] New: Interpreter allocates argv on heap

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 12 23:47:00 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15503

            Bug ID: 15503
           Summary: Interpreter allocates argv on heap
           Product: libraries
           Version: 3.1
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interpreter
          Assignee: unassignedbugs at nondot.org
          Reporter: addarathbone at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

problem: ExecutionEngine::runFunctionAsMain places command line arguments on
heap
expected: command line arguments are allocated on stack

Hello,
I have written a pass (for educational purposes), that restrictes a jitted 
program memory access to 4GB by modifying load and store operations as well as 
the JITMemoryManager. 
Thereby I recognized an undocumented/unwanted behaviour. The command line
arguments of the interpreted/jitted program are not located on the stack.

Example program:
====== argv-stack.c ======
#include <stdio.h>
int main(int argc, char *argv[]) {
  int seed;
  printf("stack: %p\n", &seed);
  printf("argv:  %p\n", argv);
}

$ clang -S -emit-llvm argv-stack.c && lli argv-stack.s
stack: 0x7fff38142854
argv:  0x7d5580

For me this results in a crash of my program.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130313/b380a8f2/attachment.html>


More information about the llvm-bugs mailing list