<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Interpreter allocates argv on heap"
   href="http://llvm.org/bugs/show_bug.cgi?id=15503">15503</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Interpreter allocates argv on heap
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.1
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Interpreter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>addarathbone@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>