This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

New testcase for __builtin_constant_p failure


This problem was found on gcc 2.96 but I have also reproduced it
on mainline.  So far, all I have been able to determine is that
making the btest macro return a scalar instead of a string, or
declaring variable 'size' as a const int papers over the problem.

OK to install in gcc.c-torture/execute?


Diego.


	* gcc.c-torture/execute/builtin-constant.c: New test.


#define btest(x) __builtin_constant_p(x) ? "1" : "0"

#ifdef __OPTIMIZE__
void
foo (char *i)
{
  if (*i == '0')
    abort ();
}
#else
void
foo (char *i)
{
}
#endif

int
main (void)
{
  int size = sizeof (int);
  foo (btest (size));
  foo (btest (size));
  exit (0);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]