view gcc/testsuite/c-c++-common/Wsign-compare-1.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +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'" } */
}