This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: testsuite, simulators, and argv[0]
Paul Brook wrote:
> foo (argv[0]);
> I'd say it's a broken test then.
It's a broken program, in full generality.
DJ, you could fix this either by checking argc != 0 in the test, or by
adding an effective-target condition that the test be run only on
targets that pass argv[0]. I think the latter choice is pedantically
more accurate -- as we will then not claim that the test passes on such
targets.
However, I think an even better fix is just to hard-code the string and
make it volatile. Presumably, the use of argv[0] here is just to keep
the compiler from optimizing the program away. So, I suggest doing
something like:
volatile char *x = "pr36321.exe";
and passing x to the function, instead of argv[0].
A patch along those lines is pre-approved.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713