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] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/*
2
   { dg-do compile }
3
   { dg-options "-Wlogical-op" }
4
*/
5
 
6
enum { a, ba, b };
7
 
8
enum testenum { t1, t2};
9
 
10
extern int c;
11
extern char bool_a, bool_b;
12
 
13
extern int testa();
14
 
15
void foo()
16
{
17
    if ( testa() && b )     /* { dg-warning "logical" } */
18
         (void)testa();
19
 
20
    if ( c && b )           /* { dg-warning "logical" } */
21
        (void)testa();
22
 
23
    if ( c && 0x42 )        /* { dg-warning "logical" } */
24
        (void)testa();
25
 
26
    if ( c && 0x80 >>6)     /* { dg-warning "logical" } */
27
        (void)testa();
28
 
29
 
30
    if ( b && c == a )      /* { dg-bogus "logical" } */
31
          (void)testa();
32
 
33
    if ( 1 && c )           /* { dg-bogus "logical" } */
34
         (void)testa();
35
 
36
    if ( t2 && b )          /* { dg-bogus "logical" } */
37
          (void)testa();
38
 
39
    if ( 0 && c == a )      /* { dg-bogus "logical" } */
40
          (void)testa();
41
 
42
    if ( b && 1 )           /* { dg-bogus "logical" } */
43
          (void)testa();
44
}
45
 
46
 
47
void bar()
48
{
49
    if ( testa() || b )     /* { dg-warning "logical" } */
50
         (void)testa();
51
 
52
    if ( c || b )           /* { dg-warning "logical" } */
53
        (void)testa();
54
 
55
    if ( c || 0x42 )        /* { dg-warning "logical" } */
56
        (void) testa();
57
 
58
    if ( c || 0x80 >>6)     /* { dg-warning "logical" } */
59
        (void)testa();
60
 
61
 
62
    if ( b || c == a )      /* { dg-bogus "logical" } */
63
          (void)testa();
64
 
65
    if ( 1 || c )           /* { dg-bogus "logical" } */
66
         (void)testa();
67
 
68
    if ( t2 || b )          /* { dg-bogus "logical" } */
69
          (void)testa();
70
 
71
    if ( 0 || c == a )      /* { dg-bogus "logical" } */
72
          (void)testa();
73
 
74
    if ( b || 1 )           /* { dg-bogus "logical" } */
75
          (void)testa();
76
}
77
 

powered by: WebSVN 2.1.0

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