Re: Simulator question about argc/argv

nick clifton
2013-06-03T11:20:21Z

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