c/2098: compare with unsigned variable - no error reporting

jochen.pernsteiner@stud.fh-regensburg.de jochen.pernsteiner@stud.fh-regensburg.de
Mon Feb 26 04:16:00 GMT 2001


>Number:         2098
>Category:       c
>Synopsis:       compare with unsigned variable - no error reporting
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 26 04:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     jochen.pernsteiner@stud.fh-regensburg.de
>Release:        2.95.2
>Organization:
>Environment:
linux i586
>Description:
If a unsigned (not signed!) variable is compared with immediate 
value which is outside the range of the variable, gcc does not
report an error. ("-Wall" does not help)

Example:

int main()
{
  unsigned char c;

  if (c==10000) return 1;
  else return 0;
}

If c is made signed, an error is reported.
 
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list