User account creation filtered due to spam.

Bug 43905 - [4.5 Regression] duplicate __PRETTY_FUNCTION__ symbol for functions differing in const-ness
Summary: [4.5 Regression] duplicate __PRETTY_FUNCTION__ symbol for functions differing...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.5.0
: P2 critical
Target Milestone: 4.5.1
Assignee: Martin Jambor
URL:
Keywords: assemble-failure, wrong-code
Depends on:
Blocks:
 
Reported: 2010-04-27 00:44 UTC by Willem Jan Palenstijn
Modified: 2014-02-16 10:00 UTC (History)
3 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2010-06-10 21:39:19


Attachments
preprocessed source file (41.47 KB, text/plain)
2010-04-27 00:48 UTC, Willem Jan Palenstijn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Willem Jan Palenstijn 2010-04-27 00:44:30 UTC
When compiling the attached lll.ii file (from lll.c from the gfan maths package at http://www.math.tu-berlin.de/~jensen/software/gfan/gfan.html ) with g++ 4.5.0, I get the following error message:

g++  -O2 lll.ii -c -o lll.o
/tmp/ccRt1FUj.s: Assembler messages:
/tmp/ccRt1FUj.s:5145: Error: symbol `_ZZN6MatrixIiEixEPiPP6VektorIiEiE19__PRETTY_FUNCTION__' is already defined


The error is not triggered with -O1, but it is triggered with -O1 -fipa-sra.

Looking at the generated .s, the problem appears to be that the same XXX__PRETTY_FUNCTION__ symbol is generated for both an operator[] and its const version.


g++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.5.0/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /usr/local/gcc-4.5.0/src/gcc-4.5.0/configure --enable-languages=c,c++,fortran --with-gnu-as --with-gnu-as=/usr/local/binutils-2.20.1/bin/as --with-gnu-ld --with-ld=/usr/local/binutils-2.20.1/bin/ld --with-gmp=/usr/local/mpir-1.2.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1 --prefix=/usr/local/gcc-4.5.0
Thread model: posix
gcc version 4.5.0 (GCC)
Comment 1 Willem Jan Palenstijn 2010-04-27 00:48:06 UTC
Created attachment 20498 [details]
preprocessed source file
Comment 2 Andrew Pinski 2010-04-27 00:52:56 UTC
Matrix<int>::operator[](int*, Vektor<int>**, int)::__PRETTY_FUNCTION__
Comment 3 Andrew Pinski 2010-04-27 02:08:43 UTC
Very reduced testcase:
 extern void sf ( __const char *);
struct Matrix{
   int operator[](int n){
   sf ( __PRETTY_FUNCTION__);
 }
   int operator[](int n)const{
   sf ( __PRETTY_FUNCTION__);
 }
 };
 void calcmy(Matrix const &b, Matrix &c, int k){
 b[k];
 c[k];
 }
Comment 4 Richard Biener 2010-04-27 09:30:04 UTC
local statics need to be mangled before SRA changes the function signature.
Comment 5 Martin Jambor 2010-06-10 21:39:19 UTC
Mine 
Comment 6 Martin Jambor 2010-06-14 12:44:39 UTC
Patch submitted to the mailing list:
http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01146.html
Comment 7 Martin Jambor 2010-06-16 12:22:11 UTC
Subject: Bug 43905

Author: jamborm
Date: Wed Jun 16 12:21:56 2010
New Revision: 160832

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160832
Log:
2010-06-16  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43905
	* tree-sra.c: Include tree-inline.h.
	(create_abstract_origin): Removed.
	(modify_function): Version the call graph node instead of creating
	abstract origins and dealing with same_body aliases.
	* tree-sra.c (ipa_sra_preliminary_function_checks): Check whether the
	function is versionable.
	* Makefile.in (tree-sra.o): Add TREE_INLINE_H to dependencies.

	* testsuite/g++.dg/torture/pr43905.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/torture/pr43905.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-sra.c

Comment 8 Jakub Jelinek 2010-06-24 11:58:36 UTC
Fixed on the trunk.
Comment 9 Martin Jambor 2010-06-29 13:16:15 UTC
4.5 patch submitted to the mailing list: http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02896.html
Comment 10 Martin Jambor 2010-06-30 13:27:11 UTC
Subject: Bug 43905

Author: jamborm
Date: Wed Jun 30 13:26:17 2010
New Revision: 161604

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161604
Log:
2010-06-30  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43905
	* tree-sra.c (encountered_recursive_call): Removed with all its uses.
	(convert_callers): Do not handle recursive calls specially.
	(create_abstract_origin): Removed.
	(modify_function): Version the call graph node instead of creating
	abstract origins and dealing with same_body aliases.
	(ipa_sra_preliminary_function_checks): Check whether the function
	is versionable.
	* Makefile.in (tree-sra.o): Add TREE_INLINE_H to dependencies.

	* testsuite/g++.dg/torture/pr43905.C: New test.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/torture/pr43905.C
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/Makefile.in
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/tree-sra.c

Comment 11 Martin Jambor 2010-07-02 13:28:16 UTC
This is now fixed on both the trunk and the 4.5 branch.
Comment 12 Jackie Rosen 2014-02-16 10:00:55 UTC Comment hidden (spam)