Bug 7025 - signed char == 0xa5 always 0 - why??
Summary: signed char == 0xa5 always 0 - why??
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: egcs
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-11-15 19:55 UTC by Matt Domsch
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-11-22 23:00:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Matt Domsch 1999-11-15 19:55:02 UTC
egcs-2.91-66 generates the following warning on this code:
[root@chameleon Linux]# gcc -o foo foo.c
foo.c: In function `main':
foo.c:6: warning: comparison is always 0 due to limited range of data type

int
main(int argc, char **argv)
{
  int rc = 0;
  char c = 0xa5, *ptr=&c;
  if (*ptr == 0xa5) rc = 1; /* This is the line that generates the warning
*/
  return rc;
}

Comment 1 Bill Nottingham 1999-11-15 21:50:59 UTC
signed char ranges from -127 to 127 (or so).
Hence, a signed char cannot be 0xa5. An unsigned char could be.


Note You need to log in before you can comment on or make changes to this bug.