view gcc/testsuite/c-c++-common/Wint-in-bool-context-2.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

/* { dg-options "-Wint-in-bool-context" } */
/* { dg-do compile } */

typedef unsigned u32;
typedef unsigned char u8;
#define KEYLENGTH 8

int foo (u8 plen, u32 key)
{
  if ((plen < KEYLENGTH) && (key << plen)) /* { dg-bogus "boolean context" } */
    return -1;

  if ((plen << KEYLENGTH) && (key < plen)) /* { dg-warning "boolean context" } */
    return -2;

  return 0;
}