void m (char16_t c0, char32_t c1)
{
    f_c (c0);	/* { dg-warning "alter its value" } */
    fsc (c0);	/* { dg-warning "alter its value" } */
    fuc (c0);	/* { dg-warning "alter its value" } */
    f_s (c0);	/* { dg-warning "change the sign" } */
    fss (c0);	/* { dg-warning "change the sign" } */
    fus (c0);
    f_i (c0);
    fsi (c0);
    fui (c0);
    f_l (c0);
    fsl (c0);
    ful (c0);
    f_ll (c0);
    fsll (c0);
    full (c0);

    f_c (c1);	/* { dg-warning "alter its value" } */
    fsc (c1);	/* { dg-warning "alter its value" } */
    fuc (c1);	/* { dg-warning "alter its value" } */
    f_s (c1);	/* { dg-warning "alter its value" } */
    fss (c1);	/* { dg-warning "alter its value" } */
    fus (c1);	/* { dg-warning "alter its value" } */
    f_i (c1);	/* { dg-warning "change the sign" "" { target { ! int16 } } } */
    fsi (c1);	/* { dg-warning "change the sign" "" { target { ! int16 } } } */
    fui (c1);
    f_l (c1);	/* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
    fsl (c1);	/* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
    ful (c1);
    f_ll (c1);
    fsll (c1);
    full (c1);
}
Exemple #2
0
void m(char16_t c0, char32_t c1)
{
    f_c (c0);	/* { dg-warning "conversion from .char16_t. to .char. may change value" } */
    fsc (c0);	/* { dg-warning "change value" } */
    fuc (c0);	/* { dg-warning "change value" } */
    f_s (c0);	/* { dg-warning "change the sign" } */
    fss (c0);	/* { dg-warning "change the sign" } */
    fus (c0);
    f_i (c0);
    fsi (c0);
    fui (c0);
    f_l (c0);
    fsl (c0);
    ful (c0);
    f_ll (c0);
    fsll (c0);
    full (c0);

    f_c (c1);	/* { dg-warning "change value" } */
    fsc (c1);	/* { dg-warning "change value" } */
    fuc (c1);	/* { dg-warning "change value" } */
    f_s (c1);	/* { dg-warning "change value" } */
    fss (c1);	/* { dg-warning "change value" } */
    fus (c1);	/* { dg-warning "change value" } */
    f_i (c1);	/* { dg-warning "change the sign" } */
    fsi (c1);	/* { dg-warning "change the sign" } */
    fui (c1);
    f_l (c1);	/* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
    fsl (c1);	/* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
    ful (c1);
    f_ll (c1);
    fsll (c1);
    full (c1);
}
Exemple #3
0
void
h2 (void)
{
  fsc (SCHAR_MAX + 1);
  fsc (SCHAR_MIN - 1); /* { dg-warning "overflow in implicit constant conversion" } */
  fsc (UCHAR_MAX);
  fsc (UCHAR_MAX + 1); /* { dg-warning "overflow in implicit constant conversion" } */
  fuc (-1);
  fuc (UCHAR_MAX + 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
  fuc (SCHAR_MIN);
  fuc (SCHAR_MIN - 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
  fuc (-UCHAR_MAX); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
}
Exemple #4
0
void
h2 (void)
{
  fsc (SCHAR_MAX + 1); /* { dg-warning "overflow in conversion from .int. to .signed char. changes value" } */
  fsc (SCHAR_MIN - 1); /* { dg-warning "overflow in conversion from .int. to .signed char. changes value" } */
  fsc (UCHAR_MAX); /* { dg-warning "overflow in conversion from .int. to .signed char. changes value" } */
  fsc (UCHAR_MAX + 1); /* { dg-warning "overflow in conversion from .int. to .signed char. changes value" } */
  fuc (-1);
  fuc (UCHAR_MAX + 1); /* { dg-warning "unsigned conversion from .int. to .unsigned char. changes value" } */
  fuc (SCHAR_MIN);
  fuc (SCHAR_MIN - 1); /* { dg-warning "unsigned conversion from .int. to .unsigned char. changes value" } */
  fuc (-UCHAR_MAX); /* { dg-warning "unsigned conversion from .int. to .unsigned char. changes value" } */
}
void
g (void)
{
  fsi(f); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */
  x.fsi(f); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */
  fsi(cf); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than complex due to prototype" } */
  x.fsi(cf); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than complex due to prototype" } */
  fcf(f); /* { dg-warning "passing argument 1 of 'fcf' as complex rather than floating due to prototype" } */
  x.fcf(f); /* { dg-warning "passing argument 1 of 'x.fcf' as complex rather than floating due to prototype" } */
  fcf(si); /* { dg-warning "passing argument 1 of 'fcf' as complex rather than integer due to prototype" } */
  x.fcf(si); /* { dg-warning "passing argument 1 of 'x.fcf' as complex rather than integer due to prototype" } */
  ff(sc); /* { dg-warning "passing argument 1 of 'ff' as floating rather than integer due to prototype" } */
  x.ff(sc); /* { dg-warning "passing argument 1 of 'x.ff' as floating rather than integer due to prototype" } */
  ff(cf); /* { dg-warning "passing argument 1 of 'ff' as floating rather than complex due to prototype" } */
  x.ff(cf); /* { dg-warning "passing argument 1 of 'x.ff' as floating rather than complex due to prototype" } */
  ff(1.0); /* { dg-warning "passing argument 1 of 'ff' as 'float' rather than 'double' due to prototype" } */
  x.ff(1.0); /* { dg-warning "passing argument 1 of 'x.ff' as 'float' rather than 'double' due to prototype" } */
  fsll(sc); /* { dg-warning "passing argument 1 of 'fsll' with different width due to prototype" } */
  x.fsll(sc); /* { dg-warning "passing argument 1 of 'x.fsll' with different width due to prototype" } */
  fsc(sll); /* { dg-warning "passing argument 1 of 'fsc' with different width due to prototype" } */
  x.fsc(sll); /* { dg-warning "passing argument 1 of 'x.fsc' with different width due to prototype" } */
  fsi(ui); /* { dg-warning "passing argument 1 of 'fsi' as signed due to prototype" } */
  x.fsi(ui); /* { dg-warning "passing argument 1 of 'x.fsi' as signed due to prototype" } */
  full(sll); /* { dg-warning "passing argument 1 of 'full' as unsigned due to prototype" } */
  x.full(sll); /* { dg-warning "passing argument 1 of 'x.full' as unsigned due to prototype" } */
}
void
h2 (void)
{
  fsc (SCHAR_MAX + 1);
  /* { dg-warning "warning: passing argument 1 of 'fsc' with different width due to prototype" "-Wconversion" { target *-*-* } 84 } */
  fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
  /* { dg-warning "warning: passing argument 1 of 'fsc' with different width due to prototype" "-Wconversion" { target *-*-* } 86 } */
  fsc (UCHAR_MAX);
  /* { dg-warning "warning: passing argument 1 of 'fsc' with different width due to prototype" "-Wconversion" { target *-*-* } 88 } */
  fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
  /* { dg-warning "warning: passing argument 1 of 'fsc' with different width due to prototype" "-Wconversion" { target *-*-* } 90 } */
  fuc (-1); /* { dg-warning "warning: negative integer implicitly converted to unsigned type" } */
  /* { dg-warning "warning: passing argument 1 of 'fuc' with different width due to prototype" "-Wconversion" { target *-*-* } 92 } */
  fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
  /* { dg-warning "warning: passing argument 1 of 'fuc' with different width due to prototype" "-Wconversion" { target *-*-* } 94 } */
  fuc (SCHAR_MIN); /* { dg-warning "warning: negative integer implicitly converted to unsigned type" } */
  /* { dg-warning "warning: passing argument 1 of 'fuc' with different width due to prototype" "-Wconversion" { target *-*-* } 96 } */
  fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
  /* { dg-warning "warning: passing argument 1 of 'fuc' with different width due to prototype" "-Wconversion" { target *-*-* } 98 } */
  fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
  /* { dg-warning "warning: passing argument 1 of 'fuc' with different width due to prototype" "-Wconversion" { target *-*-* } 100 } */
}
Exemple #7
0
int main(int argc, char *argv[])
{
  int tcount,
      count,
      lastsize,
      size;
  if ((argc > 4) || (argc < 3)) {
     FPRINTF(STDOUTFILE "\n\n   Usage: %s  <# species> <# processors> [<min chunk size>]\n\n", argv[0]);
     exit(1);
  }

  chunksize = 1;

  switch(argc) {
    case 4:
	  chunksize = atoi(argv[3]);
    case 3:
          n = numquarts(atoi(argv[1]));
          p = atoi(argv[2]);
  }

  FPRINTF(STDOUTFILE "proc=%6d\n", p);
  FPRINTF(STDOUTFILE "task=%6d\n", n);

  initsched(&testsched, n, p, chunksize);
  printsched(testsched);

  count=1; tcount = 0;
  FPRINTF(STDOUTFILE "\n\n---------------------------\n");
  FPRINTF(STDOUTFILE "SC(sched) - Static Chunking\n");
  FPRINTF(STDOUTFILE "---------------------------\n\n");
  do { size = sc(&testsched); 
       if (size > 0) {FPRINTF(STDOUTFILE "%6d. chunk = %6d %c\n", count++, size , (size%chunksize) ? '!' : ' ');
                      tcount+=size;}
       else FPRINTF(STDOUTFILE "%d tasks in %d chunks\n", tcount, (count-1));
     } while (size > 0);


  initsched(&testsched, n, p, chunksize);
  printsched(testsched);

  count=1; tcount = 0;
  FPRINTF(STDOUTFILE "\n\n---------------------------\n");
  FPRINTF(STDOUTFILE "SS(sched) - Self Scheduling\n");
  FPRINTF(STDOUTFILE "---------------------------\n\n");
  do { size = ss(&testsched); 
       if (size > 0) {if (count==1) FPRINTF(STDOUTFILE "%6d. chunk = %6d %c\n", count++, size , (size%chunksize) ? '!' : ' ');
                      count++;
                      tcount+=size;
                      lastsize = size;}
       else          {FPRINTF(STDOUTFILE "      ...\n");
                      FPRINTF(STDOUTFILE "%6d. chunk = %6d %c\n", count++, lastsize , (lastsize%chunksize) ? '!' : ' ');
                      FPRINTF(STDOUTFILE "%d tasks in %d chunks\n", tcount, (count-1));}
     } while (size > 0);


/**/
  count=1; tcount = 0;
  FPRINTF(STDOUTFILE "\n\n---------------------------\n");
  FPRINTF(STDOUTFILE "FSC() - Fixed-Size Chunking\n");
  FPRINTF(STDOUTFILE "---------------------------\n\n");
  do { size = fsc(); 
       if (size > 0) {FPRINTF(STDOUTFILE "%6d. chunk = %6d %c\n", count++, size , (size%chunksize) ? '!' : ' ');
                      tcount+=size;}
       else FPRINTF(STDOUTFILE "%d tasks in %d chunks\n", tcount, (count-1));
     } while (size > 0);
/**/

  initsched(&testsched, n, p, chunksize);
  printsched(testsched);

  count=1; tcount = 0;
  FPRINTF(STDOUTFILE "\n\n-----------------------------------\n");
  FPRINTF(STDOUTFILE "GSS(sched) - Guided Self Scheduling\n");
  FPRINTF(STDOUTFILE "-----------------------------------\n\n");
  do { size = gss(&testsched); 
       if (size > 0) {FPRINTF(STDOUTFILE "%6d. chunk = %6d %c\n", count++, size , (size%chunksize) ? '!' : ' ');
                      tcount+=size;}
       else FPRINTF(STDOUTFILE "%d tasks in %d chunks\n", tcount, (count-1));
     } while (size > 0);

  initsched(&testsched, n, p, chunksize);
  printsched(testsched);

  count=1; tcount = 0;
  FPRINTF(STDOUTFILE "\n\n--------------------------------------\n");
  FPRINTF(STDOUTFILE "TSS(sched) - Trapezoid Self Scheduling\n");
  FPRINTF(STDOUTFILE "--------------------------------------\n\n");
  do { size = tss(&testsched); 
       if (size > 0) {FPRINTF(STDOUTFILE "%6d. chunk = %6d %c\n", count++, size , (size%chunksize) ? '!' : ' ');
                      tcount+=size;}
       else FPRINTF(STDOUTFILE "%d tasks in %d chunks\n", tcount, (count-1));
     } while (size > 0);
  return (0);
}
    /**
     * Test to see if the GA can derive the correct answer
     */
    void dataFrameTest()
    {
      // load data frame
      cout << "Importing data frame... ";
      shared_ptr<DataFrame> df(new DataFrame);
      fstream fs("OttawaCars.xml", ios_base::in);
      if (fs.is_open() == false)
      {
        throw Exception("Error opening OttawaGroundCover.xml");
      }
      df->import(fs);
      cout << "done." << endl;

      shared_ptr<CalculatorGenome> genome(new CalculatorGenome());
      genome->setInitializationDepth(4);
      genome->addBasicMathNodeTypes();

      // create source node for each factor
      for (unsigned int i = 0; i < df->getNumFactors(); i++)
      {
        shared_ptr<DataFrameCalculatorNodeSource> src(new DataFrameCalculatorNodeSource(df, i));
        string label = df->getFactorLabelFromIndex(i);
        if (label != "MAX_Z_GROUND" && label != "MIN_Z_GROUND" && 
          label != "MAX_Z_AERIAL" && label != "MIN_Z_AERIAL")
        {
          genome->addNodeType(src, label, 2.0 / (double)df->getNumFactors());
        }
      }

      // create a fitness function using symmetric uncertainty
      shared_ptr<FeatureScoreCalculator> fsc(new SymmetricUncertaintyCalculator());
      shared_ptr<FeatureScoreFitnessFunction> fitness(new FeatureScoreFitnessFunction(df, fsc));

      GeneticAlgorithm ga(genome, fitness);
      ga.setPopulationSize(500);

      // population size
      // mutation rate
      // mutation severity
      // free pass
      // keep best
      // mating percent
      // fresh meat

      int c = 0;
      for (unsigned int s = 0; s < 300; s++)
      {
        ga.step();
        c+= ga.getPopulation().size();
        shared_ptr<CalculatorGenome> best = 
          dynamic_pointer_cast<CalculatorGenome>(ga.getBestGenome());
        cout << c << "\t" << best->getScore() << "\t" << best->toString() << endl;
//         if (1 / best->getScore() < 1.0)
//         {
//           break;
//         }
        //cout << endl;
        for (unsigned int i = 0; i < ga.getPopulation().size() && i < 10; i++)
        {
          cout << "  " << ga.getPopulation()[i]->getScore() << "\t" << 
            ga.getPopulation()[i]->toString() << endl;
        }
      }
    }
Exemple #9
0
void h (int x)
{
  unsigned int ui = 3;
  int   si = 3;
  unsigned char uc = 3;
  signed char   sc = 3;

  uc = ui; 
  uc = si; 
  sc = ui; 
  sc = si; 
  fuc (ui);
  fuc (si);
  fsc (ui);
  fsc (si);

  fsi (si);
  fui (ui);
  fsi (uc);
  si = uc;
  fui (uc);
  ui = uc;
  fui ('A');
  ui = 'A';
  fsi ('A');
  si = 'A';
  fuc ('A');
  uc = 'A';

  uc = x ? 1U : -1; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes value from .-1. to .\[0-9\]+." } */
  uc = x ? SCHAR_MIN : 1U;  /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes value from .-\[0-9\]+. to .\[0-9\]+." } */
  uc = x ? 1 : -1; /* { dg-warning "unsigned conversion from .int. to .unsigned char. changes the value of .-1." } */
  uc = x ? SCHAR_MIN : 1; /* { dg-warning "unsigned conversion from .int. to .unsigned char. changes the value of .-\[0-9\]+." } */
  ui = x ? 1U : -1; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes value from .-1. to .\[0-9\]+." } */
  ui = x ? INT_MIN : 1U; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes value from .-\[0-9\]+. to .\[0-9\]+." } */
  ui = ui ? SCHAR_MIN : 1U; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes value " } */
  ui = 1U * -1; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes value " } */
  ui = ui + INT_MIN; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes value " } */
  ui = x ? 1 : -1; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes the value of .-1." } */
  ui = ui ? SCHAR_MIN : 1; /* { dg-warning "unsigned conversion from .int. to .unsigned int. changes the value of " } */

  fuc (-1); /* { dg-warning "unsigned conversion" } */
  uc = -1;  /* { dg-warning "unsigned conversion" } */
  fui (-1); /* { dg-warning "unsigned conversion" } */
  ui = -1; /* { dg-warning "unsigned conversion" } */
  fuc ('\xa0'); /* { dg-warning "unsigned conversion" } */
  uc = '\xa0'; /* { dg-warning "unsigned conversion" } */
  fui ('\xa0');/* { dg-warning "unsigned conversion" } */
  ui = '\xa0'; /* { dg-warning "unsigned conversion" } */
  fsi (0x80000000); /* { dg-warning "signed conversion" } */
  si = 0x80000000;  /* { dg-warning "signed conversion" } */


  fsi (UINT_MAX - 1);  /* { dg-warning "conversion" } */
  si = UINT_MAX - 1;   /* { dg-warning "conversion" } */
  fsi (UINT_MAX - 1U); /* { dg-warning "conversion" } */
  si = UINT_MAX - 1U;  /* { dg-warning "conversion" } */
  fsi (UINT_MAX/3U);
  si = UINT_MAX/3U;
  fsi (UINT_MAX/3);
  si = UINT_MAX/3;
  fui (UINT_MAX - 1);
  ui = UINT_MAX - 1;

  uc = (unsigned char) -1;
  ui = -1 * (1 * -1);
  ui = (unsigned) -1;

  fsc (uc); /* { dg-warning "conversion" } */
  sc = uc;  /* { dg-warning "conversion" } */
  fuc (sc); /* { dg-warning "conversion" } */
  uc = sc;  /* { dg-warning "conversion" } */
  fsi (ui); /* { dg-warning "conversion" } */
  si = ui;  /* { dg-warning "conversion" } */
  fui (si); /* { dg-warning "conversion" } */
  ui = si;  /* { dg-warning "conversion" } */
  fui (sc); /* { dg-warning "conversion" } */
  ui = sc;  /* { dg-warning "conversion" } */
}
Exemple #10
0
void h (int x)
{
  unsigned int ui = 3;
  int   si = 3;
  unsigned char uc = 3;
  signed char   sc = 3;

  uc = ui; /* { dg-warning "conversion" } */
  uc = si; /* { dg-warning "conversion" } */
  sc = ui; /* { dg-warning "conversion" } */
  sc = si; /* { dg-warning "conversion" } */
  fuc (ui); /* { dg-warning "conversion" } */
  fuc (si); /* { dg-warning "conversion" } */
  fsc (ui); /* { dg-warning "conversion" } */
  fsc (si); /* { dg-warning "conversion" } */

  fsi (si);
  fui (ui);
  fsi (uc);
  si = uc;
  fui (uc);
  ui = uc;
  fui ('A');
  ui = 'A';
  fsi ('A');
  si = 'A';
  fuc ('A');
  uc = 'A';

  uc = x ? 1U : -1; /* { dg-warning "conversion" } */
  uc = x ? SCHAR_MIN : 1U; /* { dg-warning "conversion" } */
  uc = x ? 1 : -1; /* Warned by -Wsign-conversion.  */
  uc = x ? SCHAR_MIN : 1; /* Warned by -Wsign-conversion.  */
  ui = x ? 1U : -1; /* Warned by -Wsign-conversion.  */
  ui = x ? INT_MIN : 1U; /* Warned by -Wsign-conversion.  */
  ui = ui ? SCHAR_MIN : 1U; /* Warned by -Wsign-conversion.  */
  ui = 1U * -1; /* Warned by -Wsign-conversion.  */
  ui = ui + INT_MIN; /* Warned by -Wsign-conversion.  */
  ui = x ? 1 : -1; /* Warned by -Wsign-conversion.  */
  ui = ui ? SCHAR_MIN : 1; /* Warned by -Wsign-conversion.  */

  fuc (-1); /* Warned by -Wsign-conversion.  */
  uc = -1; /* Warned by -Wsign-conversion.  */
  fui (-1); /* Warned by -Wsign-conversion.  */
  ui = -1; /* Warned by -Wsign-conversion.  */
  fuc ('\xa0'); /* Warned by -Wsign-conversion.  */
  uc = '\xa0'; /* Warned by -Wsign-conversion.  */
  fui ('\xa0'); /* Warned by -Wsign-conversion.  */
  ui = '\xa0';  /* Warned by -Wsign-conversion.  */
  fsi (0x80000000); /* Warned by -Wsign-conversion.  */
  si = 0x80000000;  /* Warned by -Wsign-conversion.  */


  fsi (UINT_MAX - 1);  /* Warned by -Wsign-conversion.  */
  si = UINT_MAX - 1;   /* Warned by -Wsign-conversion.  */
  fsi (UINT_MAX - 1U); /* Warned by -Wsign-conversion.  */
  si = UINT_MAX - 1U;  /* Warned by -Wsign-conversion.  */
  fsi (UINT_MAX/3U);
  si = UINT_MAX/3U;
  fsi (UINT_MAX/3);
  si = UINT_MAX/3;
  fui (UINT_MAX - 1);
  ui = UINT_MAX - 1;

  uc = (unsigned char) -1;
  ui = -1 * (1 * -1);
  ui = (unsigned) -1;

  fsc (uc); /* Warned by -Wsign-conversion.  */
  sc = uc;  /* Warned by -Wsign-conversion.  */
  fuc (sc); /* Warned by -Wsign-conversion.  */
  uc = sc;  /* Warned by -Wsign-conversion.  */
  fsi (ui); /* Warned by -Wsign-conversion.  */
  si = ui;  /* Warned by -Wsign-conversion.  */
  fui (si); /* Warned by -Wsign-conversion.  */ 
  ui = si;  /* Warned by -Wsign-conversion.  */ 
  fui (sc); /* Warned by -Wsign-conversion.  */
  ui = sc;  /* Warned by -Wsign-conversion.  */
}