public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15177] New: G++ produces wrong mangling in a large project
@ 2004-04-27 19:34 wirawan0 at softhome dot net
  2004-04-27 19:36 ` [Bug c++/15177] " wirawan0 at softhome dot net
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 19:34 UTC (permalink / raw)
  To: gcc-bugs

A wrong mangled name was generated by g++. The wrongly generated name was for a
templatized class method. I can't reproduce it with a simple example (see
example.cpp below), so I will use a large pre-processed file to present the case.

Please try to compile the pre-processed source code below (tbhqmc-driver.ii). 

This problem is known to happen with:
- g++ 3.3.1 (cygwin)
- g++ 3.2.2 (linux/redhat 9)

If you see the postprocessed file lines 36329-36334, there are two template
class methods named "PostpxPDensity": one with a single argument, the other with
four arguments. It gets called in lines 37456 and 44768 in the same file.

Now compile that file, and inspect the assembled file (the *.s attachment
below). At line 7627 the first method (single-argument) was called
(This corresponds to line 44768 of the preprocessed source above):

call
__ZN11Hubbard_QMC14PostpxPDensityI22QMBS_Observables_FloatEEvRN12QMBS_HubbardI20EllipsoidRectLatticeILj1EE19AFQMC_BP_boson_repsI18__temporary_BvInfoEE15ObservablesBaseIT_EE

The method gets demangled into:

void Hubbard_QMC::PostpxPDensity<QMBS_Observables_Float>
(QMBS_Hubbard<EllipsoidRectLattice<(unsigned)1>,
AFQMC_BP_boson_reps<__temporary_BvInfo>
>::ObservablesBase<EllipsoidRectLattice<(unsigned)1> >&)

This is plain WRONG for the following reasons:
* There is no such method template in Hubbard_QMC class which accepts two
arguments. 
* There is also no sub-class "ObservablesBase<EllipsoidRectLattice<(unsigned)1>"
in class "AFQMC_BP_boson_reps<__temporary_BvInfo>".

Something must have been wrong inside cc1plus!


DETAILED VERSION INFO

FOR CYGWIN:

$ g++ -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld
--with-gnu-as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc
--libdir=/usr/lib --libexecdir=/usr/sbin --mandir=/usr/share/man
--infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pascal,java,objc
--enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls
--without-included-gettext --enable-interpreter --enable-sjlj-exceptions
--disable-version-specific-runtime-libs --enable-shared --disable-win32-registry
--enable-java-gc=boehm --disable-hash-synchronization --verbose
--target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)

FOR LINUX (redhat 9):

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

-- 
           Summary: G++ produces wrong mangling in a large project
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wirawan0 at softhome dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
@ 2004-04-27 19:36 ` wirawan0 at softhome dot net
  2004-04-27 19:39 ` wirawan0 at softhome dot net
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 19:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wirawan0 at softhome dot net  2004-04-27 19:34 -------
Created an attachment (id=6173)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6173&action=view)
Preprocessed source file (the testcase)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
  2004-04-27 19:36 ` [Bug c++/15177] " wirawan0 at softhome dot net
@ 2004-04-27 19:39 ` wirawan0 at softhome dot net
  2004-04-27 19:40 ` wirawan0 at softhome dot net
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 19:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wirawan0 at softhome dot net  2004-04-27 19:35 -------
Created an attachment (id=6174)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6174&action=view)
Generated assembler

Generated using g++ 3.3.1 in cygwin. Use `bzcat tbhqmc-driver.s.bz2 | c++filt 
> tbhqmc-driver.s' to get the assembler with DEMANGLED names.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
  2004-04-27 19:36 ` [Bug c++/15177] " wirawan0 at softhome dot net
  2004-04-27 19:39 ` wirawan0 at softhome dot net
@ 2004-04-27 19:40 ` wirawan0 at softhome dot net
  2004-04-27 19:42 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 19:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wirawan0 at softhome dot net  2004-04-27 19:36 -------
Created an attachment (id=6175)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6175&action=view)
Small testcase (can't reproduce bug with this)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (2 preceding siblings ...)
  2004-04-27 19:40 ` wirawan0 at softhome dot net
@ 2004-04-27 19:42 ` pinskia at gcc dot gnu dot org
  2004-04-27 20:30 ` wirawan0 at softhome dot net
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 19:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 19:37 -------
The demangler is wrong, the one which is in 3.4.0 (even though c++filt no longer builds with GCC).
gives:
void Hubbard_QMC::
PostpxPDensity<QMBS_Observables_Float>(QMBS_Hubbard<EllipsoidRectLattice<1u>, 
AFQMC_BP_boson_reps<__temporary_BvInfo> >::ObservablesBase<QMBS_Observables_Float>&)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |minor
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (3 preceding siblings ...)
  2004-04-27 19:42 ` pinskia at gcc dot gnu dot org
@ 2004-04-27 20:30 ` wirawan0 at softhome dot net
  2004-04-27 20:32 ` wirawan0 at softhome dot net
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 20:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wirawan0 at softhome dot net  2004-04-27 19:41 -------
(In reply to comment #4)
> The demangler is wrong, the one which is in 3.4.0 (even though c++filt no
longer builds with GCC).
> gives:
> void Hubbard_QMC::
> PostpxPDensity<QMBS_Observables_Float>(QMBS_Hubbard<EllipsoidRectLattice<1u>, 
> AFQMC_BP_boson_reps<__temporary_BvInfo>
>::ObservablesBase<QMBS_Observables_Float>&)

Yes, you are right! But the generated name (which was the mangled one) is still
wrong.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (4 preceding siblings ...)
  2004-04-27 20:30 ` wirawan0 at softhome dot net
@ 2004-04-27 20:32 ` wirawan0 at softhome dot net
  2004-04-27 20:56 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 20:32 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (5 preceding siblings ...)
  2004-04-27 20:32 ` wirawan0 at softhome dot net
@ 2004-04-27 20:56 ` pinskia at gcc dot gnu dot org
  2004-04-27 21:09 ` wirawan0 at softhome dot net
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 20:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 20:47 -------
The code included here is so non-complaint it is hard to test a newer compiler like 3.4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Target Milestone|3.4.0                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (6 preceding siblings ...)
  2004-04-27 20:56 ` pinskia at gcc dot gnu dot org
@ 2004-04-27 21:09 ` wirawan0 at softhome dot net
  2004-04-27 21:20 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 21:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wirawan0 at softhome dot net  2004-04-27 21:00 -------
This problem also affects g++ 3.3.2 (which is found in Fedora Core 1).

Let me try to fix the non-standard stuff so that it would compile with 3.4.0. I
have difficulty compiling 3.4.0 here. In libiberty/cplus-dem.c line 55 and 56
the declarations of malloc and realloc are not standard!

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (7 preceding siblings ...)
  2004-04-27 21:09 ` wirawan0 at softhome dot net
@ 2004-04-27 21:20 ` pinskia at gcc dot gnu dot org
  2004-04-27 22:19 ` wirawan0 at softhome dot net
  2004-07-10  1:02 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 21:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 21:03 -------
To compile 3.4.0 make sure that you are not setting LIBCFLAGS to include "-mcpu=" as -mcpu= is 
going to be removed in a future version of GCC.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (8 preceding siblings ...)
  2004-04-27 21:20 ` pinskia at gcc dot gnu dot org
@ 2004-04-27 22:19 ` wirawan0 at softhome dot net
  2004-07-10  1:02 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: wirawan0 at softhome dot net @ 2004-04-27 22:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wirawan0 at softhome dot net  2004-04-27 21:57 -------
Guess what? You're right, Andrew! It's the error in the c++ demangler that
causes the whole thing. When I looked at that again, the correct demangled name
does refer to a single-parameter class method. Sorry for the confusion; I didn't
pay attention well earlier. Let me close this thread. It's a bug in g++ 3.[23];
hopefully no longer there with 3.4+.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15177] G++ produces wrong mangling in a large project
  2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
                   ` (9 preceding siblings ...)
  2004-04-27 22:19 ` wirawan0 at softhome dot net
@ 2004-07-10  1:02 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-10  1:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15177


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-07-10  1:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 19:34 [Bug c++/15177] New: G++ produces wrong mangling in a large project wirawan0 at softhome dot net
2004-04-27 19:36 ` [Bug c++/15177] " wirawan0 at softhome dot net
2004-04-27 19:39 ` wirawan0 at softhome dot net
2004-04-27 19:40 ` wirawan0 at softhome dot net
2004-04-27 19:42 ` pinskia at gcc dot gnu dot org
2004-04-27 20:30 ` wirawan0 at softhome dot net
2004-04-27 20:32 ` wirawan0 at softhome dot net
2004-04-27 20:56 ` pinskia at gcc dot gnu dot org
2004-04-27 21:09 ` wirawan0 at softhome dot net
2004-04-27 21:20 ` pinskia at gcc dot gnu dot org
2004-04-27 22:19 ` wirawan0 at softhome dot net
2004-07-10  1:02 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).