Bug 7025 - signed char == 0xa5 always 0 - why??
signed char == 0xa5 always 0 - why??
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: egcs (Show other bugs)
6.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-11-15 14:55 EST by Matt Domsch
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-11-22 18:00:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matt Domsch 1999-11-15 14:55:02 EST
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 16:50:59 EST
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.