is V610 "Undefined behavior" a false error?

0

Does pvs-studio recognize a wrong error?

pvs-studio v. 7.02.32296 , windows 7x64

#include <stdio.h>
#include <stdint.h>

int main() {
  uint32_t a = 0xFFFFFFFF;
  uint32_t b = 0x00000000;
  uint64_t x = ((static_cast<uint64_t>(a) << 32) | static_cast<uint64_t>(b));

  printf("x: %016lX\n", x);
  return 0;
}

Why does pvs studio notice:

C:\projects\test\test.cpp (36): error V610: [CWE-758] Undefined behavior. Check the shift operator '<<'. The right operand '32' is greater than or equal to the length in bits of the promoted left operand

if x is uint64_t ?

pvs-studio
asked on Stack Overflow Jun 19, 2019 by gek • edited Jun 19, 2019 by gek

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0