public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8991: g++ 3.2.1 with -frepo on templates - puts collect2 into an infinite loop
@ 2002-12-18  9:46 Neil.Ferguson
  0 siblings, 0 replies; only message in thread
From: Neil.Ferguson @ 2002-12-18  9:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8991
>Category:       c++
>Synopsis:       g++ 3.2.1 with -frepo on templates - puts collect2 into an infinite loop
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 18 09:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Neil Ferguson
>Release:        gcc version 3.2.1; also gcc-20021216 snapshot
>Organization:
>Environment:
g++ -v:

Reading specs from /users/nf50041/lib/gcc-lib/sparc-sun-solaris2.8/3.2.1/specs
Configured with: ../gcc-3.2.1-original/configure --prefix=/users/nf50041 --with-gnu-as --with-gnu-ld --enable-languages=c,c++
Thread model: posix
gcc version 3.2.1

Also using binutils-2.13.1; uname -a gives: 

SunOS waverley 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10

and the architecture is (Ultra) sparc32. 
>Description:
When compiling a templated class which inherits from 
another templated class, and using STL capabilities, 
it is possible to put collect2 into an infinite loop 
at link time after compiling with the -frepo option. 

Using GDB, it seems that collect2 gets stuck inside 
the recompile_files() function (in tlink.c). The 
problem seems to be an interaction between g++ .rpo 
output and and .rnw output as altered by maybe_tweak(). 

On my system, the problem is always centered on a 
specific symbol listing in the various .rpo files: 
 
C _ZN16__Atomicity_lockILi0EE17_S_atomicity_lockE

When the problem appears, collect2 repeatedly calls on 
g++ to recompile two files; it alternates between them 
without recompiling any other files. 

Interestingly, using <Ctrl+C> and reissuing the link 
command allows collect2 to make progress based on the 
.rpo data from its prior execution. It usually takes 
3-4 cycles of <Ctrl+C> & retry to successfully complete 
the link and get a working executable. 
>How-To-Repeat:
The attachment contains a testcase.tar file with the 
necessary files. Unfortunately, I was unable to find 
a smaller case. Doing "make" in the testcase-failure 
directory should demonstrate the problem. 

It should compile all of the source files into separate 
objects, the issue the link command. At this point, the 
collect2 program should alternately recompile BaseClass 
and SubClass sources. 

Issuing <Ctrl+C> and make should immediately issue the 
link command, with collect2 now alternately recompiling 
Test1.cxx and one of the BaseClass/SubClass files. 

Issuing <Ctrl+C> and make again should result in collect2 
recompiling Test1.cxx and relinking a couple of times, 
before finally producing a working executable called test1.

You may need to <Ctrl+C> + make more than 3 times. You 
should run "make sterile" before "make" if you want to 
repeat the test. 
>Fix:
I traced the offending symbol to this file: 

gcc-3.2.1/libstdc++-v3/config/cpu/sparc/bits/atomicity.h 

where it uses a template to provide an atomicity spinlock 
for sparc32 atomic_add operations. The attachment contains 
an atomicity.diff file which you can patch it with, so 
that it uses an unwrapped static char rather than a static 
char member of a templated struct. 

This patch is probably an evil hack that blows the spinlock 
out of the water :-) and I suspect that the problem should 
really be fixed by changing collect2 or g++. However, I 
include it in the hope that it will be useful for initial 
experiments; I am now at the limits of my experience... 
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-tar; name="gnats-sub.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gnats-sub.tar.gz"

H4sICGSrAD4CA2duYXRzLXN1Yi50YXIA7Vp9U9vMEedf9Cl2IDzFGNmS35Q4wACOk9AhwMSkpdOn
1Zyls60HWVKlEwmToZ+9u6cXywQDmRIntLpJkHTa2729vd/e7spM+FPHcsR1zXZGo5Uf0jRd0zqa
hteW3jb05NrA56Q19Tb2GUihN7ROE++RoKMZK9rKElocCRaiSG/U1rSWvpBuHDtj7o2DhUqSJp1m
qlRz5Zk0sjqoMaghqDaMLUtt1ho1XfVDZ+x4zK27zjAStlWtqlfNuuV7I2dct4K4HgUstOpDR0R1
lu+hSYHDkNHK2k7E7e9koqiq+t9PZbWhaQ1Ve6VqHdBfdXW92+7UtKxBlXalUq1Wn2TKiTAd/7VB
fymFaX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vEJRK/C8F/1TvTSo4WRCQI2UbWAEtErB5rawIzZ0rTA/kiT9Da05IYJ11pwkm4pd+bjJl
jrdZASU5euOIHADFCVHALMpE7PTMlUkKnuTJDxsgEbdDvXuyO0r6M5nJmy2aenJyyxNZkkjqWhBH
E5OqEpv0XEmlZOSwCx7/fIubpIwyUpu7HJ1OLiDpTX6gsNm/ODo3B596vf5ggANulOeD/2IpdEn4
b+mz/F+X/Rj/GyX+n9v5XwD8Dzn+H3Qo0pndGQ3IYnT2iUUifB7br/9fo4DF+H+6GuAD+Nd1ivnT
/F9ry/PfaBjtEv8/I//PDnvwR4XcPC8EDD4dflMHKPbdHxLcCuDvPu4X1wyUeehCN8v+c747Oel3
VRMWspnVFO4rEAzmg4Dvqw/Ia8F7ovPzkt/3+mFtLqjZTKOevISCIciUe4JiEmK0kMk9K5q7wZnG
D4tLozWU98anDznpV8SbuXruHRumLLc+k+8/T5r+Pfz9p63l8V+r1ZH5H7bS//9y8V/i7u4M/tIo
bD5imwvN7q3VJPldJD8Ls8JxlFWiS6SWrWxlK1vZyla2sj1N+w+B2xU1AD4AAA==


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-18 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-18  9:46 c++/8991: g++ 3.2.1 with -frepo on templates - puts collect2 into an infinite loop Neil.Ferguson

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).