Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8034983

gcc compiler warning

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P5 P5
    • tbd
    • 9
    • client-libs
    • 2d

      I am getting this warning from some (closed source) code in the JDK Linux build

      warning: comparison is always false due to limited range of data type [-Wtype-limits]

      The code in question is using enums as in

      enum myenum { v1, v2, v3, v4);

      myenum val;
      ...
      ..
      if ( val < v1) { problem }} ;

      So the code seems reasonable
      I found a discussion here :-
      http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00972.html
      and it also seems that this ...
      http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51712

      added the new option : fno-short-enums

      I doubt that's supported yet by the gcc we use but the later comments
      conclude that should not have been needed as the warning really
      should not be raised anyway.

      I'm filing this mainly for documentation purposes.
      I'm not sure what we can do to suppress it now other than disable this class of warning.

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: