1  /* PR optimization/14235 */
       2  /* Origin: <senor_fjord@yahoo.com> */
       3  
       4  typedef signed char        int8_t;
       5  typedef short              int16_t;
       6  typedef int                int32_t;
       7  typedef unsigned long long uint64_t;
       8  
       9  static const uint64_t LOW_BYTE_MASK    = 0x00000000000000ffULL;
      10  static const uint64_t HIGH_BYTE_MASK   = 0x000000000000ff00ULL;
      11  static const uint64_t WORD_MASK        = 0x000000000000ffffULL;
      12  static const uint64_t DWORD_MASK       = 0x00000000ffffffffULL;
      13  
      14  extern uint64_t *srca_mask;
      15  extern int *assert_thrown;
      16  
      17  void foo()
      18  {
      19    uint64_t tempA = 0; /* actually a bunch of code to set A */ 
      20    uint64_t tempB = 0; /* actually a bunch of code to set B */ 
      21  
      22    /* cast A to right size */
      23    tempA = (((*srca_mask == LOW_BYTE_MASK) || 
      24              (*srca_mask == HIGH_BYTE_MASK)) ?
      25             ((int8_t)tempA) : 
      26             ((*srca_mask == WORD_MASK) ? 
      27              ((int16_t)tempA) : 
      28              ((*srca_mask == DWORD_MASK) ? 
      29               ((int32_t)tempA) : 
      30               tempA)));
      31  
      32    /* cast B to right size */
      33    tempB = (((*srca_mask == LOW_BYTE_MASK) || 
      34              (*srca_mask == HIGH_BYTE_MASK)) ? 
      35             ((int8_t)tempB) : 
      36             ((*srca_mask == WORD_MASK) ? 
      37              ((int16_t)tempB) : 
      38              ((*srca_mask == DWORD_MASK) ? 
      39               ((int32_t)tempB) : 
      40               tempB))); 
      41      
      42    if ((int) tempA > (int) tempB) { 
      43      *assert_thrown = 1;
      44    }
      45  }