diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b88c1f85d3..be1e6026bde 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-11-02 Diego Novillo + + PR optimization/8423 + * gcc.c-torture/execute/builtin-constant.c: New test. + 2002-11-01 Zack Weinberg * g++.dg/ext/typedef-init.C, gcc.dg/typedef-init.C: diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-constant.c b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.c new file mode 100644 index 00000000000..9e5bfb8bfe8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtin-constant.c @@ -0,0 +1,26 @@ +/* PR optimization/8423. */ + +#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); +}