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

Re-enable '-Wconversion' for GCC 4.3 and later

XMLWordPrintable

      Currently, we disable '-Wconversion' for GCC 4.3 and later because it produces too many warnings which are by default treated as errors. All the warnings are about narrowing conversions which may result in a potential data loss.

      It may be a good idea to fix all these implicit narrowing conversions and re-enable -Wconversion warning by default.

      Unfortunately there's quite some code which has to be changed in order to meet the requirements of '-Wconversion'. A quick research showed that there are currently 137 different implicit narrowing conversions (see below) spread over 1785 different code locations:

      warning: conversion to ‘CardIdx_t {aka int}’ from ‘uintptr_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘char’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘char’ from ‘short unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘CodeBuffer::csize_t {aka int}’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘CodeBuffer::csize_t {aka int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘CodeBuffer::csize_t {aka int}’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘CodeBuffer::csize_t {aka int}’ from ‘ptrdiff_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘CodeBuffer::csize_t {aka int}’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘CodeSection::csize_t {aka int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘jlong {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘julong {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘ssize_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘double’ from ‘uintx {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘Elf_Word {aka unsigned int}’ from ‘Elf64_Addr {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘Elf_Word {aka unsigned int}’ from ‘Elf64_Xword {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘double’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘float’ from ‘unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘InCSetState::in_cset_state_t {aka signed char}’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int16_t {aka short int}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘int32_t {aka int}’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int32_t {aka int}’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int32_t {aka int}’ from ‘jlong {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int32_t {aka int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘int32_t {aka int}’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘int32_t {aka int}’ from ‘uintx {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int8_t {aka signed char}’ from ‘int32_t {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int8_t {aka signed char}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘int8_t {aka signed char}’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘intArray::etype {aka int}’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘intArray::etype {aka int}’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘Elf64_Xword {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘jlong {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘julong {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘__off_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘ssize_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘u8 {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘uintptr_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘int’ from ‘uintx {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jboolean {aka unsigned char}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘jboolean {aka unsigned char}’ from ‘jint {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jbyte {aka signed char}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘jbyte {aka signed char}’ from ‘jint {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jchar {aka short unsigned int}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘jchar {aka short unsigned int}’ from ‘jint {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jfloat {aka float}’ from ‘double’ may alter its value [-Wconversion]
      warning: conversion to ‘jfloat {aka float}’ from ‘jdouble {aka double}’ may alter its value [-Wconversion]
      warning: conversion to ‘jint {aka int}’ from ‘int64_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jint {aka int}’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jint {aka int}’ from ‘jlong {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jint {aka int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘jint {aka int}’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘jint {aka int}’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jint {aka int}’ from ‘u8 {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jshort {aka short int}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘jshort {aka short int}’ from ‘jint {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘jubyte {aka unsigned char}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘juint {aka unsigned int}’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘juint {aka unsigned int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘juint {aka unsigned int}’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘jushort {aka short unsigned int}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘long unsigned int:40’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘narrowKlass {aka unsigned int}’ from ‘uint64_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘narrowOop {aka unsigned int}’ from ‘uint64_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘OptoReg::Name {aka int}’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘OptoReg::Name {aka int}’ from ‘uintptr_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘OSThread::thread_id_t {aka int}’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘s4 {aka int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘s_char {aka signed char}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘short int’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘short int’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short int’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short int’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘short int’ from ‘OptoReg::Name {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short unsigned int:11’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short unsigned int’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘short unsigned int’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short unsigned int’ from ‘jint {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short unsigned int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short unsigned int’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘short unsigned int’ from ‘unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘size_t {aka long unsigned int}’ from ‘double’ may alter its value [-Wconversion]
      warning: conversion to ‘u1 {aka unsigned char}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘u1 {aka unsigned char}’ from ‘u2 {aka short unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘u1 {aka unsigned char}’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘u2 {aka short unsigned int}’ from ‘int32_t {aka int}’ may alter its value [-Wconversion]
      warning: conversion to ‘u2 {aka short unsigned int}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘u2 {aka short unsigned int}’ from ‘u4 {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘u2 {aka short unsigned int}’ from ‘uintptr_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘u2 {aka short unsigned int}’ from ‘unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘u4 {aka unsigned int}’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘uint16_t {aka short unsigned int}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘uint32_t {aka unsigned int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘uint8_t {aka unsigned char}’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘uint8_t {aka unsigned char}’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘address_word {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘int64_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘jlong {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘uintptr_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘uint {aka unsigned int}’ from ‘uintx {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char:1’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char:2’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char’ from ‘int’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char’ from ‘MEMFLAGS {aka MemoryType}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char’ from ‘u2 {aka short unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char’ from ‘u4 {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char’ from ‘uint {aka unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned char’ from ‘unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘intptr_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘intx {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘julong {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘long int’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘long unsigned int’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘__off_t {aka long int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘uintptr_t {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘unsigned int’ from ‘uintx {aka long unsigned int}’ may alter its value [-Wconversion]
      warning: conversion to ‘u_short {aka short unsigned int}’ from ‘int’ may alter its value [-Wconversion]
      warning: the result of the conversion is unspecified because ‘-0x00000000000000001’ is outside the range of type ‘Dependencies::DepType’ [-Wconversion]

            Unassigned Unassigned
            simonis Volker Simonis
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: