Re: Simulator question about argc/argv

nick clifton <[email protected]> Mon, 03 Jun 2013 12:19:32 +0100
Newsgroups gmane.comp.gdb.devel,gmane.comp.gdb.general
Message-ID <[email protected]>
Hi Steve,

> Some new tests have been added to the GCC testsuite (cilk tests) that
> check the value of argc and they expect it to be 1 if there are no
> arguments to the test program (and there are none) but I am getting 0
> when I run the tests under the gnu simulator.  Does anyone know why
> this is?

Yes - many simulators do not support passing any arguments to the 
program that they are simulating.  So they set argc to zero when they 
invoke main.  (They usually also set argv to NULL and envp to NULL).

Tests that depend upon a non-zero argc value are, IMHO, dubious.  Tests 
should be able to be run in an automated fashion without anything being 
provided to them via the command line or their environment.

Cheers
   Nick