This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]