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

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 13 01:10:28 PDT 2013


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

Anton Korobeynikov <asl at math.spbu.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |asl at math.spbu.ru
         Resolution|---                         |INVALID

--- Comment #1 from Anton Korobeynikov <asl at math.spbu.ru> ---
According to C99 5.1.2.2.1:

2.
If they [argc, argv] are declared, the parameters to the main function shall
obey the following constraints:
— The value of argc shall be nonnegative.

— argv[argc] shall be a null pointer.

— If the value of argc is greater than zero, the array members argv[0] through
argv[argc-1] inclusive shall contain pointers to strings, which are given
implementation-defined values by the host environment prior to program startup.
The intent is to supply to the program information determined prior to program
startup from elsewhere in the hosted environment. If the host environment is
not capable of supplying strings with letters in both uppercase and lowercase,
the implementation
shall ensure that the strings are received in lowercase.

— If the value of argc is greater than zero, the string pointed to by argv[0]
represents the program name; argv[0][0] shall be the null character if the
program name is not available from the host environment. If the value of argc
is
greater than one, the strings pointed to by argv[1] through argv[argc-1]
represent the program parameters.

— The parameters argc and argv and the strings pointed to by the argv array
shall
be modifiable by the program, and retain their last-stored values between
program
startup and program termination.

So, the location of the arguments are implementation defined and it's pretty
fine to pass them on heap.

-- 
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/92c0a4f3/attachment.html>


More information about the llvm-bugs mailing list