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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [switch4.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-do compile }
2
// { dg-options "-fshort-enums -w" }
3
 
4
// PR c++/20008
5
 
6
// We failed to compile this because CFG cleanup left the switch
7
// statement intact, whereas expand_case expected at least one
8
// in-range case to remain.
9
 
10
typedef enum _SECStatus {
11
  SECWouldBlock = -2,
12
  SECFailure = -1,
13
  SECSuccess = 0
14
} SECStatus;
15
 
16
typedef enum {
17
  SEC_ERROR_BAD_SIGNATURE = (-0x2000) + 10
18
} SECErrorCodes;
19
 
20
void g(void);
21
void f(SECStatus status)
22
{
23
  switch( status )
24
    {
25
    case SEC_ERROR_BAD_SIGNATURE :
26
      // This case can be optimized away in C++ (but apparently not in
27
      // C), because the enum type is defined with a narrow range.
28
      g();
29
      break ;
30
    }
31
}

powered by: WebSVN 2.1.0

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