Package: cppcheck
Version: 1.75-1
Severity: normal
Dear Joachim,
First I want to say that cppcheck has much improved since the last time
I used it.
However the following C file cpp.c
#define gel(m,x1) (((long**) (m))[x1])
void
fun(long tm1[], long tm[])
{
long *tmi = gel(tm,1);
long *tm1i = gel(tm1,1);
gel(tm1i,1) = gel(tmi,1);
gel(tm1i,2) = gel(tmi,2);
}
gives:
cppcheck --enable=all cpp.c
Checking cpp.c...
[cpp.c:5]: (error) Uninitialized variable: tmi
[cpp.c:7]: (error) Uninitialized variable: tmi
[cpp.c:8]: (error) Uninitialized variable: tmi
[cpp.c:3]: (style) The function 'fun' is never used.
If I replace the first use of gel by its definition the warning
disappears.
Cheers,
Bill.
-- System Information:
Debian Release: 8.6
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
--
Bill. <[email protected]>
Imagine a large red swirl here.