http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55481



--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2012-11-27 
11:02:39 UTC ---

More reduced testcase, fails when compiled at -O2 with the C++ frontend,

passes compiled with the C frontend ...



typedef signed char int8_t;

extern void abort (void);



#define SIZE 13

double init_value = 1.0;

int8_t data8[SIZE];



static inline int8_t __attribute__((always_inline))

do_shift(int8_t input) { return ((int8_t)(23) | (int8_t)(10)); }



int main(int argc, char** argv)

{

  int8_t *first = data8;

  int8_t *last = data8+SIZE;

  while (first != last) *first++ = (int8_t)(init_value);

  first = data8;

  int i;

  for(i = 0; i < 1000; ++i)

    {

      int8_t result = 0;

      int n;

      for (n = 0; n < SIZE; ++n)

        result += do_shift( first[n] );

      int8_t temp = (int8_t)SIZE * do_shift((int8_t)init_value);

      if (result != temp)

        abort ();

    }

  return 0;

}

Reply via email to