OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wtype-limits-Wextra.C] - Diff between revs 301 and 338

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 338
/* Test that -Wtype-limits is enabled by -Wextra.  */
/* Test that -Wtype-limits is enabled by -Wextra.  */
/* { dg-do compile } */
/* { dg-do compile } */
/* { dg-options "-Wextra" } */
/* { dg-options "-Wextra" } */
extern void assert (int);
extern void assert (int);
void a (unsigned char x)
void a (unsigned char x)
{
{
  if (x < 0)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (x < 0)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
  if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
  if (0 > x)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (0 > x)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
  if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
  if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
  if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
    return;
    return;
  if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
  if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
    return;
    return;
  if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
  if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
    return;
    return;
  if (255 >= (unsigned char) 1)
  if (255 >= (unsigned char) 1)
    return;
    return;
}
}
void b (unsigned short x)
void b (unsigned short x)
{
{
  if (x < 0)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (x < 0)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
  if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
  if (0 > x)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (0 > x)  return;/* { dg-warning "comparison is always false due to limited range of data type" } */
  if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
  if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
}
}
void c (unsigned int x)
void c (unsigned int x)
{
{
  if (x < 0)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (x < 0)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (0 > x)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (0 > x)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (1U >= 0) return;
  if (1U >= 0) return;
  if (1U < 0) return;
  if (1U < 0) return;
  if (0 <= 1U) return;
  if (0 <= 1U) return;
  if (0 > 1U) return;
  if (0 > 1U) return;
}
}
void d (unsigned long x)
void d (unsigned long x)
{
{
  if (x < 0)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (x < 0)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (0 > x)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (0 > x)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
}
}
void e (unsigned long long x)
void e (unsigned long long x)
{
{
  if (x < 0)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (x < 0)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (0 > x)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (0 > x)  return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
  if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
  if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
}
}
int test (int x)
int test (int x)
{
{
  if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
  if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
    return 1;
    return 1;
  else
  else
    return 0;
    return 0;
}
}
template 
template 
void f(Int x) {
void f(Int x) {
  assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
  assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
}
}
int ff(void) {
int ff(void) {
  f(5);
  f(5);
  f(5);
  f(5);
}
}
template 
template 
void g(void) {
void g(void) {
  assert(0 <= D);
  assert(0 <= D);
}
}
int gg(void) {
int gg(void) {
  g();
  g();
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.