This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
New testcase for __builtin_constant_p failure
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 1 Nov 2002 10:11:54 -0500
- Subject: New testcase for __builtin_constant_p failure
- Organization: Red Hat Canada
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);
}