Bug 4584 - lib/replace/strptime.c: unsigned integer is being compared to zero
Summary: lib/replace/strptime.c: unsigned integer is being compared to zero
Status: RESOLVED WONTFIX
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.25
Hardware: SGI IRIX
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-30 13:50 UTC by Jason Mader (mail bounces back)
Modified: 2020-01-19 22:19 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Mader (mail bounces back) 2007-04-30 13:50:53 UTC
cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 424
  An unsigned integer is being compared to zero.

          get_number (0, 99, 2);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 473
  An unsigned integer is being compared to zero.

          get_number (0, 23, 2);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 498
  An unsigned integer is being compared to zero.

          get_number (0, 59, 2);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 589
  An unsigned integer is being compared to zero.

          get_number (0, 61, 2);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 623
  An unsigned integer is being compared to zero.

          get_number (0, 99, 2);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 638
  An unsigned integer is being compared to zero.

          get_number (0, 53, 2);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 644
  An unsigned integer is being compared to zero.

          get_number (0, 6, 1);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 653
  An unsigned integer is being compared to zero.

          get_number (0, 99, 2);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 663
  An unsigned integer is being compared to zero.

          get_number (0, 9999, 4);
          ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 872
  An unsigned integer is being compared to zero.

              get_alt_number (0, 23, 2);
              ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 892
  An unsigned integer is being compared to zero.

              get_alt_number (0, 59, 2);
              ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 897
  An unsigned integer is being compared to zero.

              get_alt_number (0, 61, 2);
              ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 903
  An unsigned integer is being compared to zero.

              get_alt_number (0, 53, 2);
              ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 909
  An unsigned integer is being compared to zero.

              get_alt_number (0, 6, 1);
              ^

cc-1183 c99: WARNING File = lib/replace/strptime.c, Line = 915
  An unsigned integer is being compared to zero.

              get_alt_number (0, 99, 2);
              ^
Comment 1 Jason Mader (mail bounces back) 2007-05-17 14:52:40 UTC
This one is still in 3.0.25 release.
Comment 2 Douglas Bagnall 2020-01-19 22:19:06 UTC
This is because we have:

  size_t val;

Then in the get number macro:

    if (val < from || val > to)                                               \
      return NULL;

where 'from' and 'to' are the first two argmuents:

          get_number (0, 99, 2);

so we have an always false size_t < 0 comparison.

But it doesn't matter, because in these cases we are only interested in ensuring it is less than 'to'. GCC presumably looks at the branch condition as a whole.

So we can close this with the IRIX compiler keeping its honour. It wasn't *completely* out of its mind.