On Mon, Jun 03, 2013 at 12:27:15PM -0600, Jeff Law wrote:
> On 06/03/2013 11:49 AM, Steve Ellcey wrote:
> >
> >A number of the new cilk tests in gcc/testsuite/c-c++-common/cilk-plus/AN
> >fail for me when run via the gnu simulator on mips. The problem is that
> >the gnu simulator does not set up argc and argv. After asking in the gdb
> >mailing list I believe this is an issue for multiple simulators on multiple
> >platforms. Looking through the GCC testsuite I did not see any other tests
> >that looked at argc/argv so I would like to change these tests to not use
> >argc/argv either. In some tests I added a define (IN_GCC_TESTSUITE) that
> >I set to 1 and then don't check argc if this is set, in others I just used
> >the constant value 1 instead of using argc and in one (where argc was being
> >changed) I replaced the use of argc with a local variable.
> >
> >Tested on mips-mti-elf with the GNU simulator.
> Yea, this should have been caught earlier. argc/argv aren't set
> properly in many simulator environments.
>
> >> {
> > int x = 0;
> >- if (argc == 1)
> >+ if (argc == 1 || IN_GCC_TESTSUITE)
> So why not just eliminate the conditional completely and simplify
> the test appropriately? The only reason I can think of to keep it
> as-is would be if the test were from another suite and we wanted to
> minimize the amount of divergence from that other testsuite.
Another reason (at least in a couple of tests I think that is the case)
is that argc is used as a variable without known compile time value, but
with expected known runtime value. That can be replaced with something
like:
int var = 1;
__asm volatile ("" : "+r" (var));
or so.
Jakub