Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 7025 - signed char == 0xa5 always 0 - why??
Summary: signed char == 0xa5 always 0 - why??
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: egcs
Version: 6.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
Depends On:
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:
Last Closed: 1999-11-22 23:00:40 UTC

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

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.