[cfe-dev] test failure in SourceManager::getLineNumber()

Jay Foad jay.foad at gmail.com
Mon May 18 05:52:46 PDT 2009


If I build with ENABLE_EXPENSIVE_CHECKS=1, I get this failure in
Preprocessor/header_lookup1.c. The "are not partitioned" error comes
from the fact that __last is actually pointing not to *just* past the
end of the sorted values, but to one element further on than that.

The attached patch fixes it for me, and I think it's correct, but
there are a lot of ad hoc "+1" and "-1"s in that function that make me
feel a bit uncomfortable (in particular maybe this one could do with a
comment:

  unsigned QueriedFilePos = FilePos+1;

)

Thanks,
Jay.


/usr/include/c++/4.3/bits/stl_algo.h:2082:error: elements in iterator range
    [__first, __last) are not partitioned by the value __val.

Objects involved in the operation:
iterator "__first" @ 0x0xbf859830 {
type = Pj;
}
iterator "__last" @ 0x0xbf859834 {
type = Pj;
}
0   clang-cc       0x091e2c4f
1   clang-cc       0x091e32ee
2                  0x4001c400 __kernel_sigreturn + 0
3   libc.so.6      0x4019d018 abort + 392
4   libstdc++.so.6 0x4009f531
__gnu_debug::_Error_formatter::_M_error() const + 529
5   clang-cc       0x0827f584
6   clang-cc       0x085637db
7   clang-cc       0x085638f3
8   clang-cc       0x080d73d9
9   clang-cc       0x080d76af
10  clang-cc       0x080d77bc
11  clang-cc       0x080d7ef7
12  clang-cc       0x0811514c
13  clang-cc       0x081166ec main + 2626
14  libc.so.6      0x40186455 __libc_start_main + 229
15  clang-cc       0x08096561
Stack dump:
0.      Program arguments:
/home/foad/llvm/objdir-svn/Debug+Checks/bin/clang-cc -I /usr/include
/home/foad/svn/llvm-project/cfe/trunk/test/Preprocessor/header_lookup1.c
-E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.sourcemanager
Type: application/octet-stream
Size: 395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090518/6ff23c57/attachment.obj>


More information about the cfe-dev mailing list