http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59846

            Bug ID: 59846
           Summary: Imprecise column number for -Wtype-limits
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

GCC outputs a wrong column number of a type-limit (comparison between 0 and
unsigned) warning. 

$ gcc-trunk -Wall -Wextra -c -std=c11 -pedantic s.c
s.c: In function ‘fn1’:
s.c:33:3: warning: comparison is always false due to limited range of data type
[-Wtype-limits]
   return b ^= (   b    <        (0UL > p));
   ^

$ clang-trunk -Wall -Wextra -c -std=c11 -pedantic s.c
s.c:33:38: warning: comparison of 0 > unsigned expression is always false
[-Wtautological-compare]
  return b ^= (   b    <        (0UL > p));
                                 ~~~ ^ ~
1 warning generated.

$ cat s.c
int fn1(unsigned p) {
  int b = 99;
  return b ^= (   b    <        (0UL > p));
}

Reply via email to