Package: cppcheck
Version: 1.55-1
Severity: wishlist

Hi,

running cppcheck on this snippet

int foo() {
    char* p = (char*) new float[100];
    return (int)(((float*)p)[42]);
    // return (int)(reinterpret_cast<float*>(p)[42]);
}

gives

[/tmp/cppcheck.cpp:3]: (warning) Casting between integer* and float* which
have an incompatible binary data representation

But there is no such cast, only from char* to float*, and from float to int.
IMHO there should be no warning at all (let's assume the leak of p here).

Using a reinterpret_cast instead has the same problem (see commented line).

Regards,
  Joachim

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (910, 'testing'), (800, 'stable'), (200, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cppcheck depends on:
ii  libc6            2.13-33
ii  libgcc1          1:4.7.1-2
ii  libpcre3         1:8.30-5
ii  libstdc++6       4.7.1-2
ii  libtinyxml2.6.2  2.6.2-1

cppcheck recommends no packages.

cppcheck suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to