view gcc/testsuite/c-c++-common/Wsign-compare-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* PR c/81417 */
/* { dg-do compile } */
/* { dg-options "-Wsign-compare" } */

int
fn1 (signed int a, unsigned int b)
{
  return a < b; /* { dg-warning "comparison of integer expressions of different signedness: 'int' and 'unsigned int'" } */
}

int
fn2 (signed int a, unsigned int b)
{
  return b < a; /* { dg-warning "comparison of integer expressions of different signedness: 'unsigned int' and 'int'" } */
}

int
fn3 (signed long int a, unsigned long int b)
{
  return b < a; /* { dg-warning "comparison of integer expressions of different signedness: 'long unsigned int' and 'long int'" } */
}

int
fn4 (signed short int a, unsigned int b)
{
  return b < a; /* { dg-warning "comparison of integer expressions of different signedness: 'unsigned int' and 'short int'" } */
}

int
fn5 (unsigned int a, signed int b)
{
  return a < b; /* { dg-warning "comparison of integer expressions of different signedness: 'unsigned int' and 'int'" } */
}