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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [Wlogical-op-1.c] - Rev 754

Go to most recent revision | Compare with Previous | Blame | View Log

/*
   { dg-do compile }
   { dg-options "-Wlogical-op" }
*/
 
enum { a, ba, b };
 
enum testenum { t1, t2};
 
extern int c;
extern char bool_a, bool_b;
 
extern int testa();
 
void foo()
{
    if ( testa() && b )     /* { dg-warning "logical" } */
         (void)testa();
 
    if ( c && b )           /* { dg-warning "logical" } */
	(void)testa();
 
    if ( c && 0x42 )        /* { dg-warning "logical" } */
	(void)testa();
 
    if ( c && 0x80 >>6)     /* { dg-warning "logical" } */
	(void)testa();
 
 
    if ( b && c == a )      /* { dg-bogus "logical" } */
          (void)testa();
 
    if ( 1 && c )           /* { dg-bogus "logical" } */
         (void)testa();
 
    if ( t2 && b )          /* { dg-bogus "logical" } */
          (void)testa();
 
    if ( 0 && c == a )      /* { dg-bogus "logical" } */
          (void)testa();
 
    if ( b && 1 )           /* { dg-bogus "logical" } */
          (void)testa();
}
 
 
void bar()
{
    if ( testa() || b )     /* { dg-warning "logical" } */
         (void)testa();
 
    if ( c || b )           /* { dg-warning "logical" } */
	(void)testa();
 
    if ( c || 0x42 )        /* { dg-warning "logical" } */
	(void) testa();
 
    if ( c || 0x80 >>6)     /* { dg-warning "logical" } */
	(void)testa();
 
 
    if ( b || c == a )      /* { dg-bogus "logical" } */
          (void)testa();
 
    if ( 1 || c )           /* { dg-bogus "logical" } */
         (void)testa();
 
    if ( t2 || b )          /* { dg-bogus "logical" } */
          (void)testa();
 
    if ( 0 || c == a )      /* { dg-bogus "logical" } */
          (void)testa();
 
    if ( b || 1 )           /* { dg-bogus "logical" } */
          (void)testa();
}
 
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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