From: Andrew Pinski <apin...@marvell.com> So I was looking at some older PRs (PR 16016 in this case), I noticed that some of the testcases were removed when the tree-ssa branch was merged. This adds them back in.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski gcc/testsuite/ChangeLog: PR testsuite/101517 * g++.dg/warn/Wunused-18.C: New test. * gcc.c-torture/compile/20030405-2.c: New test. * gcc.c-torture/compile/20040304-2.c: New test. * gcc.dg/20030612-2.c: New test. --- gcc/testsuite/g++.dg/warn/Wunused-18.C | 13 +++++ .../gcc.c-torture/compile/20030405-2.c | 58 +++++++++++++++++++ .../gcc.c-torture/compile/20040304-2.c | 45 ++++++++++++++ gcc/testsuite/gcc.dg/20030612-2.c | 20 +++++++ 4 files changed, 136 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wunused-18.C create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030405-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040304-2.c create mode 100644 gcc/testsuite/gcc.dg/20030612-2.c diff --git a/gcc/testsuite/g++.dg/warn/Wunused-18.C b/gcc/testsuite/g++.dg/warn/Wunused-18.C new file mode 100644 index 00000000000..06d1a0516bc --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-18.C @@ -0,0 +1,13 @@ +// PR c++/14199 +// { dg-options "-W -Wall -Wunused" } + +struct X { + static void foo (); +}; + +template <typename T> +void foo (const T &t) { + t.foo(); +} + +template void foo (const X &); diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-2.c b/gcc/testsuite/gcc.c-torture/compile/20030405-2.c new file mode 100644 index 00000000000..2e61f1fa3ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030405-2.c @@ -0,0 +1,58 @@ +/* PR optimization/10024 */ +extern int *allegro_errno; +typedef long fixed; +extern inline int +fixfloor (fixed x) +{ + if (x >= 0) + return (x >> 16); + else + return ~((~x) >> 16); +} +extern inline int +fixtoi (fixed x) +{ + return fixfloor (x) + ((x & 0x8000) >> 15); +} +extern inline fixed +ftofix (double x) +{ + if (x > 32767.0) + { + *allegro_errno = 34; + return 0x7FFFFFFF; + } + if (x < -32767.0) + { + *allegro_errno = 34; + return -0x7FFFFFFF; + } + return (long) (x * 65536.0 + (x < 0 ? -0.5 : 0.5)); +} +extern inline double +fixtof (fixed x) +{ + return (double) x / 65536.0; +} +extern inline fixed +fixdiv (fixed x, fixed y) +{ + if (y == 0) + { + *allegro_errno = 34; + return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF; + } + else + return ftofix (fixtof (x) / fixtof (y)); +} +extern inline fixed +itofix (int x) +{ + return x << 16; +} + +int +foo (int n) +{ + return fixtoi (fixdiv (itofix (512), itofix (n))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20040304-2.c b/gcc/testsuite/gcc.c-torture/compile/20040304-2.c new file mode 100644 index 00000000000..146d42f23d6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040304-2.c @@ -0,0 +1,45 @@ +/* PR optimization/14235 */ +/* Origin: <senor_fj...@yahoo.com> */ + +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef unsigned long long uint64_t; + +static const uint64_t LOW_BYTE_MASK = 0x00000000000000ffULL; +static const uint64_t HIGH_BYTE_MASK = 0x000000000000ff00ULL; +static const uint64_t WORD_MASK = 0x000000000000ffffULL; +static const uint64_t DWORD_MASK = 0x00000000ffffffffULL; + +extern uint64_t *srca_mask; +extern int *assert_thrown; + +void foo() +{ + uint64_t tempA = 0; /* actually a bunch of code to set A */ + uint64_t tempB = 0; /* actually a bunch of code to set B */ + + /* cast A to right size */ + tempA = (((*srca_mask == LOW_BYTE_MASK) || + (*srca_mask == HIGH_BYTE_MASK)) ? + ((int8_t)tempA) : + ((*srca_mask == WORD_MASK) ? + ((int16_t)tempA) : + ((*srca_mask == DWORD_MASK) ? + ((int32_t)tempA) : + tempA))); + + /* cast B to right size */ + tempB = (((*srca_mask == LOW_BYTE_MASK) || + (*srca_mask == HIGH_BYTE_MASK)) ? + ((int8_t)tempB) : + ((*srca_mask == WORD_MASK) ? + ((int16_t)tempB) : + ((*srca_mask == DWORD_MASK) ? + ((int32_t)tempB) : + tempB))); + + if ((int) tempA > (int) tempB) { + *assert_thrown = 1; + } +} diff --git a/gcc/testsuite/gcc.dg/20030612-2.c b/gcc/testsuite/gcc.dg/20030612-2.c new file mode 100644 index 00000000000..f9f212caba1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030612-2.c @@ -0,0 +1,20 @@ +/* Derived from PR middle-end/168. */ + +/* { dg-do compile } */ +/* { dg-options "-W" } */ + +extern void foo (); + +unsigned char uc; +unsigned short int usi; +unsigned int ui; + + +void bar() +{ + if (uc + usi >= ui) /* { dg-bogus "between signed and unsigned" } */ + foo (); + if (uc * usi >= ui) /* { dg-bogus "between signed and unsigned" } */ + foo (); +} + -- 2.27.0