You are not logged in.

#1 2013-04-02 16:09:29

ridcully
Member
Registered: 2009-03-28
Posts: 49

[SOLVED] Issues related to update to gcc 4.8?

Hi,

gcc 4.8 was "in my system update" today and after the upgrade the compilation of my C++ project fails. I'm a bit puzzled about the issues since I'm using clang for compiling the code, but however the errors point to gcc. For example:

./core/PacketTrap.cpp:21:18: error: no viable overloaded '='
    for (iterator=trappedPackets.begin(); iterator!=trappedPackets.end(); iterator++) {
         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/hashtable_policy.h:231:12: note: candidate function (the implicit copy assignment operator) not viable: no known conversion
      from '_Node_iterator<[2 * ...], 1>' to '_Node_iterator<[2 * ...], 0>' for 1st argument
    struct _Node_iterator
           ^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/hashtable_policy.h:231:12: note: candidate function (the implicit move assignment operator) not viable: no known conversion
      from '_Node_iterator<[2 * ...], 1>' to '_Node_iterator<[2 * ...], 0>' for 1st argument
    struct _Node_iterator
           ^
./core/PacketTrap.cpp:21:51: error: invalid operands to binary expression ('unordered_map<AddressPtr, PacketSet *>::iterator' (aka '_Node_iterator<value_type, __constant_iterators::value,
      __hash_cached::value>') and 'iterator' (aka '_Node_iterator<value_type, __constant_iterators::value, __hash_cached::value>'))
    for (iterator=trappedPackets.begin(); iterator!=trappedPackets.end(); iterator++) {
                                          ~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_pair.h:227:5: note: candidate template ignored: failed template argument deduction
    operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_iterator.h:303:5: note: candidate template ignored: failed template argument deduction
    operator!=(const reverse_iterator<_Iterator>& __x,
    ^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_iterator.h:353:5: note: candidate template ignored: failed template argument deduction
    operator!=(const reverse_iterator<_IteratorL>& __x,
    ^
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_iterator.h:817:5: note: candidate template ignored: failed template argument deduction
    operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,

And this goes on and on. Maybe somebody can give me a hint which has changed most recently and why somehow it is not possible to deduct the type in the containers I'm using (at least that seems to be the problem). Also, why is it using code in gcc 4.8 - somehow I was expecting that clang uses the libstdc++  code.

Thanks in advance!
Best regards,
  Michael

P.S.: I can give you the link to the github repository. However, this seems to be a compiler issue and not a code issue (since it worked before and something is messed up).

Last edited by ridcully (2013-04-28 07:13:32)

Offline

#2 2013-04-02 17:27:53

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,095
Website

Re: [SOLVED] Issues related to update to gcc 4.8?

ridcully wrote:

P.S.: I can give you the link to the github repository. However, this seems to be a compiler issue and not a code issue (since it worked before and something is messed up).

Without a link to the code, this is merely a guessing game.

Offline

#3 2013-04-02 17:54:16

ridcully
Member
Registered: 2009-03-28
Posts: 49

Re: [SOLVED] Issues related to update to gcc 4.8?

falconindy wrote:
ridcully wrote:

P.S.: I can give you the link to the github repository. However, this seems to be a compiler issue and not a code issue (since it worked before and something is messed up).

Without a link to the code, this is merely a guessing game.

I don't think that is really "related" to the code since it compiles fine at my workstation at home (here, it is gcc 4.7.2, clang 3.2). However, here is the link to the code:

https://github.com/des-testbed/Ara-Sim/ … etTrap.cpp

I strongly advice you not to checkout and try to compile it since it requires OMNeT++ (a network simulator (in AUR)) and the INETMANET package (which is a submodule) to the projects repository.

Offline

#4 2013-04-07 20:42:47

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: [SOLVED] Issues related to update to gcc 4.8?

Looks like you should be using a

std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*, AddressHash, AddressPredicate>::iterator

not a

std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*>::iterator

Last edited by tavianator (2013-04-07 20:43:53)

Offline

#5 2013-04-09 14:37:56

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: [SOLVED] Issues related to update to gcc 4.8?

ridcully wrote:

I don't think that is really "related" to the code since it compiles fine at my workstation at home (here, it is gcc 4.7.2, clang 3.2).

If I had a dollar every time I heard a similar statement I'd... well, I'd have less than a hundred dollars, sure.

For something as straightforward as iterators, I'd be very very very surprised if it was a GCC bug.  Suspect your code first, always.

Offline

#6 2013-04-28 07:13:03

ridcully
Member
Registered: 2009-03-28
Posts: 49

Re: [SOLVED] Issues related to update to gcc 4.8?

tavianator wrote:

Looks like you should be using a

std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*, AddressHash, AddressPredicate>::iterator

not a

std::unordered_map<std::shared_ptr<Address>, std::unordered_set<Packet*, PacketHash, PacketPredicate>*>::iterator

Okay, that was actually the "problem". Thank you very much for your help. However, I still don't understand why this was not an issue with gcc<=4.8.


If I had a dollar every time I heard a similar statement I'd... well, I'd have less than a hundred dollars, sure.

You are absolutely right, but if the code works on every machine which has an older version of gcc/clang and breaks on every machine with the current version you suspect that there is at least a change in the "evaluation" of the code.

Offline

#7 2013-04-28 17:53:52

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: [SOLVED] Issues related to update to gcc 4.8?

Probably because gcc (actually libstdc++, the gcc implementation of the STL) had a bug which is now fixed.

Offline

Board footer

Powered by FluxBB