[PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails

Alan Lawrence alan.lawrence@arm.com
Wed Nov 25 17:32:00 GMT 2015


On 16/11/15 21:04, Doug Evans wrote:
> Hi.
>
> Apologies for the delay.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
>
> Tested with current trunk.
>
> 2015-11-16  Doug Evans  <dje@google.com>
>
>      PR libstdc++/67440
>      * python/libstdcxx/v6/printers.py (find_type): Handle "const" in
>      type name.
>      * testsuite/libstdc++-prettyprinters/debug.cc: Add test for
>      const set<int>.
>      * testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
>      * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.

On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on 
either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:

/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc: In 
function 'int main()':
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43: 
error: in C++98 'const_intset' must be initialized by constructor, not by '{...}'
    const std::set<int> const_intset = {2, 3};
                                            ^
In file included from 
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/map:60:0,
                  from 
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:31:
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_tree.h: 
In instantiation of 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, 
_Alloc>::_M_insert_unique(_II, _II) [with _InputIterator = int; _Key = int; _Val 
= int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = 
std::allocator<int>]':
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_set.h:171:4: 
   required from 'std::set<_Key, _Compare, _Alloc>::set(_InputIterator, 
_InputIterator) [with _InputIterator = int; _Key = int; _Compare = 
std::less<int>; _Alloc = std::allocator<int>]'
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43: 
   required from here
/work/alalaw01/build_dje/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_tree.h:2224:29: 
error: invalid type argument of unary '*' (have 'int')
     _M_insert_unique_(end(), *__first, __an);
                              ^
compiler exited with status 1
UNRESOLVED: libstdc++-prettyprinters/simple.cc compilation failed to produce 
executable
Spawning: gdb -nw -nx -quiet -batch -ex "python print(gdb.type_printers)"
spawn gdb -nw -nx -quiet -batch -ex python print(gdb.type_printers)
[]
spawn gdb -nx -nw -quiet -batch -x simple.gdb
simple.gdb:2: Error in sourced command file:
./simple.exe: No such file or directory.
skipping: simple.gdb:2: Error in sourced command file:
skipping: ./simple.exe: No such file or directory.
UNSUPPORTED: libstdc++-prettyprinters/simple.cc

I also see signs of the same on powerpc64le 
(https://gcc.gnu.org/ml/gcc-testresults/2015-11/msg02699.html), the test looks 
to be passing on trunk on all three platforms.

Thanks, Alan



More information about the Gcc-patches mailing list