Bug 37791

Summary: switch does not handle signed values specified with 0x
Product: [Retired] Red Hat Linux Reporter: Need Real Name <swir>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-15 14:39:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2001-04-26 11:53:14 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)


The following code chunk demonstrates the problem. This generates a 
compile error. I have noticed that if I insert VALUE_A=-1, it compiles OK.

const int VALUE_A = 0xA04F1000;
const int VALUE_B = 0x00000099;

static void Fred(const int nType)
{
 switch ( nType )
    {
  case VALUE_A : break;
  case VALUE_B : break;
  }
}


Reproducible: Always
Steps to Reproduce:
1. COmpile the code in the above description
2.
3.
	

Actual Results:  test.cpp: In function `int main (int, char **)':
test.cpp:9: warning: overflow in implicit constant conversion
test.cpp:9: warning: case value out of range


Expected Results:  should compile OK

Comment 1 Alan Cox 2002-12-15 14:39:30 UTC
This is not a bug. Check the C standards document.