Bug 44473 - iterators already defined for std::vector when using std::decimal
Summary: iterators already defined for std::vector when using std::decimal
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 51121 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-09 03:14 UTC by Ryan Long
Modified: 2011-11-14 16:21 UTC (History)
2 users (show)

See Also:
Host: RHEL5.5
Target: x86_64-unknown-linux-gnu
Build: --with-gmp=/devsandbox/cxp/ext/compiler/gmp/ --with-mpc=/devsand
Known to work:
Known to fail:
Last reconfirmed: 2010-06-09 22:02:26


Attachments
Preprocessed file (23.70 KB, text/plain)
2010-06-09 03:15 UTC, Ryan Long
Details
Example code (136 bytes, text/plain)
2010-06-09 03:17 UTC, Ryan Long
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Long 2010-06-09 03:14:56 UTC
If checking empty then attempting to push back the following errors are reported:
main.s: Assembler messages:
main.s:2236: Error: symbol `_ZNK9__gnu_cxx17__normal_iteratorIPDfSt6vectorIDfSaIDfEEE4baseEv' is already defined
main.s:2542: Error: symbol `_ZN9__gnu_cxx17__normal_iteratorIPDfSt6vectorIDfSaIDfEEEC2ERKS1_' is already defined

Preprocessed file: http://dl.dropbox.com/u/2280/main.ii
Example code:
#include <decimal/decimal>
#include <vector>

int main()
{
    std::vector<std::decimal::decimal32> vec;

    if (vec.empty())
    {
        vec.push_back(std::decimal::decimal32(0));
    }

    return 0;
}
Comment 1 Ryan Long 2010-06-09 03:15:47 UTC
Created attachment 20871 [details]
Preprocessed file
Comment 2 Ryan Long 2010-06-09 03:17:24 UTC
Created attachment 20872 [details]
Example code
Comment 3 Paolo Carlini 2010-06-09 08:27:35 UTC
Janis, this doesn't make sense to me, and for sure happens only with decimal. Can you have a look?
Comment 4 Jonathan Wakely 2010-06-09 10:22:09 UTC
Comment on attachment 20871 [details]
Preprocessed file

attachment's mimetype changed to text/plain
Comment 5 joseph@codesourcery.com 2010-06-09 20:14:05 UTC
Subject: Re:  iterators already defined for std::vector when
 using std::decimal

On Wed, 9 Jun 2010, paolo dot carlini at oracle dot com wrote:

> Janis, this doesn't make sense to me, and for sure happens only with decimal.
> Can you have a look?
> 
> 
> -- 
> 
> paolo dot carlini at oracle dot com changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |janis187 at us dot ibm dot
>                    |                            |com

Janis is no longer at IBM....

http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01516.html

(her assignment has now come through, according to copyright.list)

Comment 6 Paolo Carlini 2010-06-09 21:48:17 UTC
Oops, thanks Joseph.
Comment 7 Janis Johnson 2010-06-10 21:58:13 UTC
The new decimal* classes are sometimes treated as classes, sometimes as scalars.  From a first look, something might be going wrong with the use of __are_same in bits/std_iterator.h so that it needs special casing for these odd classes.  I'll continue digging slowly, but don't let that stop anyone else from jumping in here.
Comment 8 Paolo Carlini 2010-06-10 23:23:49 UTC
Thanks Janis. I think that Jason reviewed your C++ contributions regarding decimal floating point, thus, once more, I'm adding him in CC hoping for help on this issue.

In a nutshell, it seems that something is going wrong when templates - in this specific case, __gnu_cxx::__normal_iterator - are instantiated for std::decimal: we end up with multiple definitions of member functions - in this case, the constructor from pointer and base() - in the assembly generated by GCC.
Comment 9 Paolo Carlini 2010-08-29 17:32:30 UTC
Jason, any hint about the best way to attack this?
Comment 10 Paolo Carlini 2011-09-28 22:11:33 UTC
Gosh, I thought this had been fixed! Any news?
Comment 11 Janis Johnson 2011-09-28 23:04:13 UTC
There's a patch here:

  http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00625.html

approved here:

   http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01208.html

Apparently I never checked it in.  I'll test it and ask on gcc-patches if I can check it in now.
Comment 12 Paolo Carlini 2011-09-28 23:08:13 UTC
Great. Make sure to add Jason in CC for faster feedback.
Comment 13 Paolo Carlini 2011-09-30 09:44:50 UTC
By the way, the patch is approved thus we don't need further feedback to commi it and fix this annoying issue. I'll just do it later today, if nobody beats me!
Comment 14 Janis Johnson 2011-09-30 17:33:48 UTC
Author: janis
Date: Fri Sep 30 17:33:41 2011
New Revision: 179399

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179399
Log:
gcc/cp
	PR c++/44473
	* mangle.c (write_type): Handle CV qualifiers for decimal classes.
gcc/testsuite
	PR c++/44473
	* g++.dg/dfp/44473-1.C: New test.
	* g++.dg/dfp/44473-2.C: New test.
	* g++.dg/dfp/mangle-1.C: New test.
	* g++.dg/dfp/mangle-2.C: New test.
	* g++.dg/dfp/mangle-3.C: New test.
	* g++.dg/dfp/mangle-4.C: New test.
	* g++.dg/dfp/mangle-5.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/dfp/44473-1.C
    trunk/gcc/testsuite/g++.dg/dfp/44473-2.C
    trunk/gcc/testsuite/g++.dg/dfp/mangle-1.C
    trunk/gcc/testsuite/g++.dg/dfp/mangle-2.C
    trunk/gcc/testsuite/g++.dg/dfp/mangle-3.C
    trunk/gcc/testsuite/g++.dg/dfp/mangle-4.C
    trunk/gcc/testsuite/g++.dg/dfp/mangle-5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/gcc/testsuite/ChangeLog
Comment 15 Paolo Carlini 2011-09-30 20:12:53 UTC
Confirmed fixed. Thanks!
Comment 16 Peter Bergner 2011-10-11 16:59:09 UTC
Author: bergner
Date: Tue Oct 11 16:58:59 2011
New Revision: 179808

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179808
Log:
gcc/
	PR c++/44473
	* mangle.c (write_type): Handle CV qualifiers for decimal classes.

gcc/testsuite/
	PR c++/44473
	* g++.dg/dfp/44473-1.C: New test.
	* g++.dg/dfp/44473-2.C: New test.
	* g++.dg/dfp/mangle-1.C: New test.
	* g++.dg/dfp/mangle-2.C: New test.
	* g++.dg/dfp/mangle-3.C: New test.
	* g++.dg/dfp/mangle-4.C: New test.
	* g++.dg/dfp/mangle-5.C: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/44473-1.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/44473-2.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-1.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-2.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-3.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-4.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-5.C
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/mangle.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Comment 17 Peter Bergner 2011-10-11 17:02:51 UTC
Author: bergner
Date: Tue Oct 11 17:02:42 2011
New Revision: 179809

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179809
Log:
gcc/
	PR c++/44473
	* mangle.c (write_type): Handle CV qualifiers for decimal classes.

gcc/testsuite/
	PR c++/44473
	* g++.dg/dfp/44473-1.C: New test.
	* g++.dg/dfp/44473-2.C: New test.
	* g++.dg/dfp/mangle-1.C: New test.
	* g++.dg/dfp/mangle-2.C: New test.
	* g++.dg/dfp/mangle-3.C: New test.
	* g++.dg/dfp/mangle-4.C: New test.
	* g++.dg/dfp/mangle-5.C: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/44473-1.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/44473-2.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-1.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-2.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-3.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-4.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-5.C
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/mangle.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 18 Peter Bergner 2011-10-11 17:17:49 UTC
Author: bergner
Date: Tue Oct 11 17:17:43 2011
New Revision: 179810

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179810
Log:
gcc/
	PR c++/44473
	* mangle.c (write_type): Handle CV qualifiers for decimal classes.

gcc/testsuite/
	PR c++/44473
	* g++.dg/dfp/44473-1.C: New test.
	* g++.dg/dfp/44473-2.C: New test.
	* g++.dg/dfp/mangle-1.C: New test.
	* g++.dg/dfp/mangle-2.C: New test.
	* g++.dg/dfp/mangle-3.C: New test.
	* g++.dg/dfp/mangle-4.C: New test.
	* g++.dg/dfp/mangle-5.C: New test.

Added:
    branches/ibm/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/44473-1.C
    branches/ibm/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/44473-2.C
    branches/ibm/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-1.C
    branches/ibm/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-2.C
    branches/ibm/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-3.C
    branches/ibm/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-4.C
    branches/ibm/gcc-4_5-branch/gcc/testsuite/g++.dg/dfp/mangle-5.C
Modified:
    branches/ibm/gcc-4_5-branch/gcc/ChangeLog.ibm
    branches/ibm/gcc-4_5-branch/gcc/cp/mangle.c
    branches/ibm/gcc-4_5-branch/gcc/testsuite/ChangeLog.ibm
Comment 19 Peter Bergner 2011-10-11 17:24:39 UTC
Author: bergner
Date: Tue Oct 11 17:24:27 2011
New Revision: 179811

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179811
Log:
gcc/
	PR c++/44473
	* mangle.c (write_type): Handle CV qualifiers for decimal classes.

gcc/testsuite/
	PR c++/44473
	* g++.dg/dfp/44473-1.C: New test.
	* g++.dg/dfp/44473-2.C: New test.
	* g++.dg/dfp/mangle-1.C: New test.
	* g++.dg/dfp/mangle-2.C: New test.
	* g++.dg/dfp/mangle-3.C: New test.
	* g++.dg/dfp/mangle-4.C: New test.
	* g++.dg/dfp/mangle-5.C: New test.

Added:
    branches/ibm/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/44473-1.C
    branches/ibm/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/44473-2.C
    branches/ibm/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-1.C
    branches/ibm/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-2.C
    branches/ibm/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-3.C
    branches/ibm/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-4.C
    branches/ibm/gcc-4_6-branch/gcc/testsuite/g++.dg/dfp/mangle-5.C
Modified:
    branches/ibm/gcc-4_6-branch/gcc/ChangeLog.ibm
    branches/ibm/gcc-4_6-branch/gcc/cp/mangle.c
    branches/ibm/gcc-4_6-branch/gcc/testsuite/ChangeLog.ibm
Comment 20 Paolo Carlini 2011-11-14 16:21:08 UTC
*** Bug 51121 has been marked as a duplicate of this bug. ***