Unicorn with delicious cookie
Мы используем куки, чтобы пользоваться сайтом было удобно.
Хорошо
to the top
>
>
>
Примеры ошибок, обнаруженных с...

Примеры ошибок, обнаруженных с помощью диагностики V615

V615. Suspicious explicit conversion from 'float *' type to 'double *' type.


OpenJDK

V615 An odd explicit conversion from 'double *' type to 'float *' type. mlib_ImageConvMxN_Fp.c 294


mlib_status mlib_convMxNext_f32(...)
{
  mlib_d64 dspace[1024], *dsa = dspace;
  ....
  mlib_f32 *fsa;
  ....

  if (3 * wid_e + m > 1024) {
    dsa = mlib_malloc((3 * wid_e + m) * sizeof(mlib_d64));

    if (dsa == NULL)
      return MLIB_FAILURE;
  }

  fsa = (mlib_f32 *) dsa; // <=
  ....
}

Similar errors can be found in some other places:

  • V615 An odd explicit conversion from 'double *' type to 'float *' type. mlib_ImageLookUp_Bit.c 525
  • V615 An odd explicit conversion from 'double *' type to 'float *' type. mlib_ImageLookUp_Bit.c 526

Xenia

V615 An odd explicit conversion from 'double *' type to 'float *' type. emulator.cc 595


bool Emulator::ExceptionCallback(....)
{
  ....
  double f[32];
  ....
  for (int i = 0; i < 32; i++) {
    XELOGE(" f{:<3} = {:016X} = (double){} = (float){}", i,
           *reinterpret_cast<uint64_t*>(&context->f[i]),    // <=
            context->f[i],
           *(float*)&context->f[i]);                        // <=
  }
  ....
}

Here are two dangerous conversions from the pointer to 'double'. These conversions violates the strict aliasing rules. It leads to undefined behavior.