Bug 20611 - duplicate label for inlined function referencing TLS
Summary: duplicate label for inlined function referencing TLS
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.4
: P2 normal
Target Milestone: 3.4.4
Assignee: Alan Modra
URL:
Keywords: patch, wrong-code
Depends on:
Blocks:
 
Reported: 2005-03-23 23:06 UTC by Janis Johnson
Modified: 2005-03-31 12:16 UTC (History)
3 users (show)

See Also:
Host: powerpc-linux
Target: powerpc-linux
Build: powerpc-linux
Known to work: 4.0.0 4.1.0
Known to fail:
Last reconfirmed: 2005-03-30 01:26:10


Attachments
minimized test case (279 bytes, text/plain)
2005-03-23 23:08 UTC, Janis Johnson
Details
patch to paper over the problem on 3.4 branch (384 bytes, patch)
2005-03-29 19:12 UTC, Janis Johnson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2005-03-23 23:06:48 UTC
PAPI fails to build on powerpc-linux with "-O3 -fPIC" due to multiple
symbols of the same name in assembler output.  The minimized test case
demonstrates the problem.
                                                                                
The failure occurs on the 3.4 branch (the FSF version in which TLS is
first supported for powerpc-linux) and on the hammer-3.3 and 3.4-rhl
branches, but not on mainline or the 4.0 branch.  There is not a
problem with 64-bit compilation.
                                                                                
I'll run a regression hunt to determine when the fix was added and
hope that it's something smaller than the tree-ssa merge.
Comment 1 Janis Johnson 2005-03-23 23:08:10 UTC
Created attachment 8438 [details]
minimized test case
Comment 2 Andrew Pinski 2005-03-23 23:44:59 UTC
.LTLS0:

Confirmed, I really doubt it was fixed by the tree-ssa merge.
Comment 3 Andrew Pinski 2005-03-23 23:46:50 UTC
Though the code which generates the label is the same so it might be the tree-ssa merge after all.
Comment 4 Andrew Pinski 2005-03-24 00:23:47 UTC
Ok, what is happening here is we are committing too early to a label name.  There should be an easy 
way of fixing this.  Note the problem shows up in .31.bbro which duplicates the BBs.  This must likely 
can be shown still on the mainline/4.0 branch but it is harder to find an example where we do.
Comment 5 Andrew Pinski 2005-03-24 00:30:29 UTC
I think the trick which I did for darwin and its pic label could be used here but I don't have time to fix 
this bug.

See <http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00722.html>.
Comment 6 Andrew Pinski 2005-03-24 01:23:41 UTC
I wonder if this is because we turned off something inbetween 3.4.0 and 4.0.0.
Comment 7 Janis Johnson 2005-03-24 18:16:33 UTC
This was fixed as part of a gigantic patch: hot/cold partitioning in 
http://gcc.gnu.org/ml/gcc-cvs/2004-04/msg00348.html.
Comment 8 Janis Johnson 2005-03-25 01:07:02 UTC
I found some code in the hot/cold partitioning patch that makes a difference
even with -fno-reorder-blocks-and-partition and am testing it on the
3.4-branch.
Comment 9 Janis Johnson 2005-03-29 19:12:24 UTC
Created attachment 8490 [details]
patch to paper over the problem on 3.4 branch

It turns out that the original preprocessed sources for papi.c only
fail on SUSE's SLES9 compiler and their current hammer-3.3 branch.
The minimized testcase fails with SUSE's hammer branch and also with
the 3.4 branch and with Red Hat's 3.4-rhl branch.  A workaround for
3.4 and 3.4-rhl is -fno-reorder-blocks, but that workaround does
not work with the 3.3-hammer branch.
									       

The attached patch, backported from the hot/cold partioning patch,
allows the minimized testcase to work with the 3.4 branch but it
probably just papers over the problem so I'm not submitting it now.
The real fix is beyond my abilities so I'm unassigning this bug from
myself.  I've copied Alan, who can undoubtedly fix it correctly if
he has the time.
Comment 10 Andrew Pinski 2005-03-29 19:15:45 UTC
I figured that this could be a bug in the mainline still.
Comment 11 Alan Modra 2005-03-30 03:40:09 UTC
Patch here: http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02676.html
Comment 12 CVS Commits 2005-03-31 11:33:39 UTC
Subject: Bug 20611

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amodra@gcc.gnu.org	2005-03-31 11:33:18

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.c 
	gcc/testsuite  : ChangeLog 

Log message:
	PR target/20611
	* config/rs6000/rs6000.md (load_toc_v4_PIC_1b): Remove inline
	label operand.  Remove (use (unspec..)).  Don't emit a label on
	the offset word.
	* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Don't
	generate inline label for load_toc_v4_PIC_1b.
	(rs6000_emit_load_toc_table): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8049&r2=2.8050
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.800&r2=1.801
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5242&r2=1.5243

Comment 13 CVS Commits 2005-03-31 11:34:43 UTC
Subject: Bug 20611

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amodra@gcc.gnu.org	2005-03-31 11:34:20

Modified files:
	gcc/config/rs6000: rs6000.md 

Log message:
	PR target/20611
	missed from last commit.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.md.diff?cvsroot=gcc&r1=1.357&r2=1.358

Comment 14 CVS Commits 2005-03-31 11:39:56 UTC
Subject: Bug 20611

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	amodra@gcc.gnu.org	2005-03-31 11:39:34

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.c rs6000.md 

Log message:
	PR target/20611
	* config/rs6000/rs6000.md (load_toc_v4_PIC_1b): Remove inline
	label operand.  Remove (use (unspec..)).  Don't emit a label on
	the offset word.
	* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Don't
	generate inline label for load_toc_v4_PIC_1b.
	(rs6000_emit_load_toc_table): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.101&r2=2.7592.2.102
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.788.2.3&r2=1.788.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.md.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.350.2.1&r2=1.350.2.2

Comment 15 CVS Commits 2005-03-31 11:46:05 UTC
Subject: Bug 20611

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	amodra@gcc.gnu.org	2005-03-31 11:45:51

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.c rs6000.md 

Log message:
	PR target/20611
	* config/rs6000/rs6000.md (load_toc_v4_PIC_1b): Remove inline
	label operand.  Remove (use (unspec..)).  Don't emit a label on
	the offset word.
	* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Don't
	generate inline label for load_toc_v4_PIC_1b.
	(rs6000_emit_load_toc_table): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.829&r2=2.2326.2.830
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.576.2.42&r2=1.576.2.43
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.284.4.17&r2=1.284.4.18

Comment 16 Alan Modra 2005-03-31 11:48:00 UTC
Fixed on 3.4, 4.0 and mainline.