Re: cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c

From: Date: Sun, 14 Jan 2007 11:10:17 +0000
Subject: Re: cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
References: 1 2 3 4  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-42720@lists.php.net to get a copy of this message
As the commit log says, I fixed a few valgrind warnings in the bug24594.phpt test (it was reading one past the end of the array). The log is still available at http://gcov.php.net/viewer.php?version=PHP_5_2&func=valgrind&file=ext%2Fgd%2Ftests%2Fbug24594.phpt the fix is this part: - for (; x<=wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc) ; x++) { + for (; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc) ; x++) {
What is the OS/compiler/cpu on this box? I remember that there was warnings/errors there but nobody else was able to reproduce. Can you reproduce this warning on your local box?
It is reproducible everywhere, I must say (including my pc). wx2 is the size of the array, so you can only read from idx 0 to (wx2-1). Reading idx wx2 doesn't make sense. For statistics, the gcov machine has Debian stable (gcc 3.3) and a Celeron cpu.
It is really dead code and it was even marked as such. It is impossible (excluding compiler/cpu/memory/.. bugs) to reach the code I removed. If you feel scary with such trivial changes that means the extension hasn't enough tests :P (ok, kidding. that part of the code is covered)
I did not say that this code is used or reached. I said that I liked to keep it. I do feel good with this function (I will not rewrite the old one and put my result in a stable branche if I was not), that's not the question. I only liked to keep it or at the very least to put it in a comment. It helps to quickly get the whole picture when you read the function after a long time :)
uhm the code was something like this: for (...; A && !B && C; ..) { if (B) { break; } How is B true there if it must be false to enter in the 'for' loop? It can't. Anyway you are the extension maintainer, so feel free to revert the patch and/or not merge it to libgd.
The code can still be further optimized when using square images, but I didn't deliberately make such change in an RC phase and without your approval.
I like to first see a patch for this optimization. There is many special cases or things to worry about here and BC is important. I'm not saying that an optimization is not possible or welcome, only that I like to see it prior to commit.
Sure. I said I wasn't going to make it for now (before php 5.2.1 is released). After that I can look at it (and no, it won't have any BC issues). You'll be the first to read it, don't worry ;) Nuno

« previous php.cvs (#42720) next »