Open Quuxplusone opened 11 years ago
Thanks, Grzegorz. Can you attach a preprocessed file, so that we don't have to worry about configuration differences here?
Hm. I don't see this with checker-272 or with trunk on the preprocessed file. How did you run scan-build over this project?
This is what I got. Looking at the code, I found this very much not plausible http://cl.ly/image/0z1p2C153b3n
I simply used scan-build ./configure and then scan-build make -j 9 (8 cores on this mbpr) .
Ah, you said the bug is in fe-lobj.c, but the source and preprocessed file come from formatting.c.
Oh dear. That's what happens when you answer two or three emails at the same
time, and trying to fix few bugs at the same time.
Sorry mate :/
Attached formatting.c
(130514 bytes, application/octet-stream): formatting.c from postgresql project
Attached formatting.all.c.bz2
(59921 bytes, application/x-bzip2): preprocessed formatting.c
Attached fe-lobj.all.c.bz2
(23669 bytes, application/x-bzip2): preprocessed fe-lobj.c
It looks like lo_initialize is too big (has too many stacked branches) for the
analyzer to reason about. It's a little unfortunate that the null check and
early return get thrown out with that, but the analyzer has to guess whether
modeling a particular call is worth the extra time spent in analysis, and in
this case it doesn't know that there's a cheap early return in there that
produce better results.
Workaround:
if (foo == null)
return;
if (foo->bar == null)
if (initialize(foo) < 0)
return;
Can I configure clang to go on and do it ?
This code doesn't look very complicated, and in any case - I want to go on and
analyse everything I throw at it. That's its job. ;)
formatting.c
(130514 bytes, application/octet-stream)formatting.all.c.bz2
(59921 bytes, application/x-bzip2)fe-lobj.all.c.bz2
(23669 bytes, application/x-bzip2)