Martin Minkler
Wed May 3 15:44:00 GMT 2000

Dear sirs,

while coding we made a small but magnificient mistake that we only found
by accident roughly 8 hours later while restructuring the whole code
only due to the fact that the error was not reported by the compiler.
To get to the point, using calloc we unfortunately used the format
(a*b) instead of the correct (a,b) to allocate the number of "a" memory
cells with the size of "b".
to quote the wrong code: "x=(double *)calloc(dim*sizeof(double));"
No error message or warning was displayed, therefore the last place on
earth we looked for the mistake causing very unexpected and unreplicable
values (that were only partially wrong) was the calloc line.
With the second value being optional the compiler could only have
displayed a warning like "unsolicited code in line xxx", but it would have
caught our attention...

best regards,

P. Hartmann
A. Hedenstroem
Y. Mertens
M. Minkler

More information about the Gcc-bugs mailing list