Bug 147451 - gcc(1): "gcc -g -O2 -march=nocona" loops compiling devel/qt4-script
Summary: gcc(1): "gcc -g -O2 -march=nocona" loops compiling devel/qt4-script
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: 8.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 22:10 UTC by Peter Jeremy
Modified: 2019-03-16 12:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Jeremy 2010-06-03 22:10:02 UTC
	The compilation of .../JavaScriptCore/interpreter/Interpreter.cpp
	in ports/devel/qt4-script loops, with cc1plus slowly eating memory
	until it hits ulimit or runs out of swap, when compiled with
	'-g -O2 -march=nocona'

	Removing either '-g' or '-march-nocona' causes the compilation to
	succeed normally in 30 seconds or less.  With both specified,
	I saw the cc1plus VSZ grow to over 1.5GB and use over 70 minutes
	of CPU before I gave up watching.

Fix: 

Unclear
How-To-Repeat: 	cd /usr/ports/devel/qt4-script
	make clean
	make configure
	cd WRKDIRPREFIX/usr/ports/devel/qt4-script/work/qt-everywhere-opensource-src-4.6.2/src/script
	c++ -c -O2 -g -march=nocona -pipe -fno-strict-aliasing -Wreturn-type -fno-strict-aliasing -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -DQT_SHARED -DJSC=QTJSC -Djscyyparse=qtjscyyparse -Djscyylex=qtjscyylex -Djscyyerror=qtjscyyerror -DWTF=QTWTF -DQT_BUILD_SCRIPT_LIB -DQT_NO_USING_NAMESPACE -DQLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DBUILDING_QT__=1 -DNDEBUG -DBUILDING_QT__ -DBUILDING_JavaScriptCore -DBUILDING_WTF -DWTF_USE_JAVASCRIPTCORE_BINDINGS=1 -DWTF_CHANGES=1 -DNDEBUG -DJS_EXPORT= -DJS_EXPORTDATA= -DQT_NO_DEBUG -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I../../include/QtCore -I../../include -I../3rdparty/javascriptcore/JavaScriptCore -I../3rdparty/javascriptcore -I../3rdparty/javascriptcore/JavaScriptCore/assembler -I../3rdparty/javascriptcore/JavaScriptCore/bytecode -I../3rdparty/javascriptcore/JavaScriptCore/bytecompiler -I!
 ../3rdparty/javascriptcore/JavaScriptCore/debugger -I../3rdparty/javascriptcore/JavaScriptCore/interpreter -I../3rdparty/javascriptcore/JavaScriptCore/jit -I../3rdparty/javascriptcore/JavaScriptCore/parser -I../3rdparty/javascriptcore/JavaScriptCore/profiler -I../3rdparty/javascriptcore/JavaScriptCore/runtime -I../3rdparty/javascriptcore/JavaScriptCore/wrec -I../3rdparty/javascriptcore/JavaScriptCore/wtf -I../3rdparty/javascriptcore/JavaScriptCore/wtf/unicode -I../3rdparty/javascriptcore/JavaScriptCore/yarr -I../3rdparty/javascriptcore/JavaScriptCore/API -I../3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders -Igenerated -I../../include/QtScript -I.rcc/release-shared -I/usr/ports/work/usr/ports/devel/qt4-script/work/qt-everywhere-opensource-src-4.6.2/src/3rdparty/javascriptcore/WebKit/qt/Api -I../3rdparty/javascriptcore/JavaScriptCore/pcre -I/usr/ports/work/usr/ports/devel/qt4-script/work/qt-everywhere-opensource-src-4.6.2/src/3rdparty/javascriptcore/WebKitBuild/Relea!
 se/JavaScriptCore/tmp -I../3rdparty/javascriptcore/JavaScriptC!
 ore -I../3rdparty/javascriptcore/JavaScriptCore/parser -I../3rdparty/javascriptcore/JavaScriptCore/bytecompiler -I../3rdparty/javascriptcore/JavaScriptCore/debugger -I../3rdparty/javascriptcore/JavaScriptCore/runtime -I../3rdparty/javascriptcore/JavaScriptCore/wtf -I/usr/ports/work/usr/ports/devel/qt4-script/work/qt-everywhere-opensource-src-4.6.2/src/script/../3rdparty/javascriptcore/JavaScriptCore/unicode -I../3rdparty/javascriptcore/JavaScriptCore/interpreter -I../3rdparty/javascriptcore/JavaScriptCore/jit -I../3rdparty/javascriptcore/JavaScriptCore/profiler -I../3rdparty/javascriptcore/JavaScriptCore/wrec -I../3rdparty/javascriptcore/JavaScriptCore/API -I../3rdparty/javascriptcore/JavaScriptCore/bytecode -I../3rdparty/javascriptcore/JavaScriptCore/assembler -I../3rdparty/javascriptcore/JavaScriptCore/generated -I. -Iparser -I.moc/release-shared -I/usr/local/include -o obj/release/Interpreter.o ../3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp

	[The above command line was extracted from the actual build log
	and run manually with different options to check the problem]
Comment 1 Garrett Cooper 2010-06-04 02:49:35 UTC
On Thu, Jun 3, 2010 at 2:06 PM, Peter Jeremy <peterjeremy@acm.org> wrote:
>
>>Number: =A0 =A0 =A0 =A0 147451
>>Category: =A0 =A0 =A0 bin
>>Synopsis: =A0 =A0 =A0 "gcc -g -O2 -march=3Dnocona" loops compiling devel/=
qt4-script
>>Confidential: =A0 no
>>Severity: =A0 =A0 =A0 non-critical
>>Priority: =A0 =A0 =A0 low
>>Responsible: =A0 =A0freebsd-bugs
>>State: =A0 =A0 =A0 =A0 =A0open
>>Quarter:
>>Keywords:
>>Date-Required:
>>Class: =A0 =A0 =A0 =A0 =A0sw-bug
>>Submitter-Id: =A0 current-users
>>Arrival-Date: =A0 Thu Jun 03 21:10:02 UTC 2010
>>Closed-Date:
>>Last-Modified:
>>Originator: =A0 =A0 Peter Jeremy
>>Release: =A0 =A0 =A0 =A0FreeBSD 8.0-STABLE amd64
>>Organization:
> n/a
>>Environment:
> System: FreeBSD server.vk2pj.dyndns.org 8.0-STABLE FreeBSD 8.0-STABLE #3:=
 Mon Apr 5 10:18:04 EST 2010 root@server.vk2pj.dyndns.org:/var/obj/usr/src/=
sys/server amd64
>
> GNU C++ version 4.2.1 20070719 =A0[FreeBSD] (amd64-undermydesk-freebsd)
> =A0 =A0 =A0 =A0compiled by GNU C version 4.2.1 20070719 =A0[FreeBSD].
>
> Also occurs on 8.1-PRERELEASE from early June.
>
>>Description:
> =A0 =A0 =A0 =A0The compilation of .../JavaScriptCore/interpreter/Interpre=
ter.cpp
> =A0 =A0 =A0 =A0in ports/devel/qt4-script loops, with cc1plus slowly eatin=
g memory
> =A0 =A0 =A0 =A0until it hits ulimit or runs out of swap, when compiled wi=
th
> =A0 =A0 =A0 =A0'-g -O2 -march=3Dnocona'
>
> =A0 =A0 =A0 =A0Removing either '-g' or '-march-nocona' causes the compila=
tion to
> =A0 =A0 =A0 =A0succeed normally in 30 seconds or less. =A0With both speci=
fied,
> =A0 =A0 =A0 =A0I saw the cc1plus VSZ grow to over 1.5GB and use over 70 m=
inutes
> =A0 =A0 =A0 =A0of CPU before I gave up watching.
>
>>How-To-Repeat:
> =A0 =A0 =A0 =A0cd /usr/ports/devel/qt4-script
> =A0 =A0 =A0 =A0make clean
> =A0 =A0 =A0 =A0make configure
> =A0 =A0 =A0 =A0cd WRKDIRPREFIX/usr/ports/devel/qt4-script/work/qt-everywh=
ere-opensource-src-4.6.2/src/script
> =A0 =A0 =A0 =A0c++ -c -O2 -g -march=3Dnocona -pipe -fno-strict-aliasing -=
Wreturn-type -fno-strict-aliasing -O2 -fvisibility=3Dhidden -fvisibility-in=
lines-hidden -fPIC -DQT_SHARED -DJSC=3DQTJSC -Djscyyparse=3Dqtjscyyparse -D=
jscyylex=3Dqtjscyylex -Djscyyerror=3Dqtjscyyerror -DWTF=3DQTWTF -DQT_BUILD_=
SCRIPT_LIB -DQT_NO_USING_NAMESPACE -DQLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -DQ=
T_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -=
DBUILDING_QT__=3D1 -DNDEBUG -DBUILDING_QT__ -DBUILDING_JavaScriptCore -DBUI=
LDING_WTF -DWTF_USE_JAVASCRIPTCORE_BINDINGS=3D1 -DWTF_CHANGES=3D1 -DNDEBUG =
-DJS_EXPORT=3D -DJS_EXPORTDATA=3D -DQT_NO_DEBUG -DQT_CORE_LIB -D_LARGEFILE6=
4_SOURCE -D_LARGEFILE_SOURCE -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I.=
 -I../../include/QtCore -I../../include -I../3rdparty/javascriptcore/JavaSc=
riptCore -I../3rdparty/javascriptcore -I../3rdparty/javascriptcore/JavaScri=
ptCore/assembler -I../3rdparty/javascriptcore/JavaScriptCore/bytecode -I../=
3rdparty/javascriptcore/JavaScriptCore/bytecompiler -I!
> =A0../3rdparty/javascriptcore/JavaScriptCore/debugger -I../3rdparty/javas=
criptcore/JavaScriptCore/interpreter -I../3rdparty/javascriptcore/JavaScrip=
tCore/jit -I../3rdparty/javascriptcore/JavaScriptCore/parser -I../3rdparty/=
javascriptcore/JavaScriptCore/profiler -I../3rdparty/javascriptcore/JavaScr=
iptCore/runtime -I../3rdparty/javascriptcore/JavaScriptCore/wrec -I../3rdpa=
rty/javascriptcore/JavaScriptCore/wtf -I../3rdparty/javascriptcore/JavaScri=
ptCore/wtf/unicode -I../3rdparty/javascriptcore/JavaScriptCore/yarr -I../3r=
dparty/javascriptcore/JavaScriptCore/API -I../3rdparty/javascriptcore/JavaS=
criptCore/ForwardingHeaders -Igenerated -I../../include/QtScript -I.rcc/rel=
ease-shared -I/usr/ports/work/usr/ports/devel/qt4-script/work/qt-everywhere=
-opensource-src-4.6.2/src/3rdparty/javascriptcore/WebKit/qt/Api -I../3rdpar=
ty/javascriptcore/JavaScriptCore/pcre -I/usr/ports/work/usr/ports/devel/qt4=
-script/work/qt-everywhere-opensource-src-4.6.2/src/3rdparty/javascriptcore=
/WebKitBuild/Relea!
> =A0se/JavaScriptCore/tmp -I../3rdparty/javascriptcore/JavaScriptC!
> =A0ore -I../3rdparty/javascriptcore/JavaScriptCore/parser -I../3rdparty/j=
avascriptcore/JavaScriptCore/bytecompiler -I../3rdparty/javascriptcore/Java=
ScriptCore/debugger -I../3rdparty/javascriptcore/JavaScriptCore/runtime -I.=
./3rdparty/javascriptcore/JavaScriptCore/wtf -I/usr/ports/work/usr/ports/de=
vel/qt4-script/work/qt-everywhere-opensource-src-4.6.2/src/script/../3rdpar=
ty/javascriptcore/JavaScriptCore/unicode -I../3rdparty/javascriptcore/JavaS=
criptCore/interpreter -I../3rdparty/javascriptcore/JavaScriptCore/jit -I../=
3rdparty/javascriptcore/JavaScriptCore/profiler -I../3rdparty/javascriptcor=
e/JavaScriptCore/wrec -I../3rdparty/javascriptcore/JavaScriptCore/API -I../=
3rdparty/javascriptcore/JavaScriptCore/bytecode -I../3rdparty/javascriptcor=
e/JavaScriptCore/assembler -I../3rdparty/javascriptcore/JavaScriptCore/gene=
rated -I. -Iparser -I.moc/release-shared -I/usr/local/include -o obj/releas=
e/Interpreter.o ../3rdparty/javascriptcore/JavaScriptCore/interpreter/Inter=
preter.cpp
>
> =A0 =A0 =A0 =A0[The above command line was extracted from the actual buil=
d log
> =A0 =A0 =A0 =A0and run manually with different options to check the probl=
em]

Worked for me on this machine, but I have over 12GB of RAM... so not
really a fair comparison.

$ ls -d /var/db/pkg/qt4-script-4.6.2/; uname -a; sysctl hw.physmem
/var/db/pkg/qt4-script-4.6.2/
FreeBSD bioshock.cisco.com 9.0-CURRENT FreeBSD 9.0-CURRENT #2 r206173:
Tue May 25 13:21:21 PDT 2010
root@bioshock.cisco.com:/usr/obj/usr/src/sys/BIOSHOCK  amd64
hw.physmem: 12867121152

This is probably one of those ridiculous optimizer bugs like what
happened with x11-servers/xorg-server back in the day when 4.2.1 was
initially imported...

Thanks,
-Garrett
Comment 2 Peter Jeremy 2010-06-04 23:52:49 UTC
On 2010-Jun-03 18:49:35 -0700, Garrett Cooper <yanefbsd@gmail.com> wrote:
>Worked for me on this machine, but I have over 12GB of RAM... so not
>really a fair comparison.


I tried again on a different host (2.5GHz Athlon 4850e with 2GB RAM
and 9GB swap) and "-O2 -g -march=nocona" ran out of swap after 7.6 hrs
CPU.  "-O2", "-O2 -g" and "-O2 -march=nocona" each ran in 25-30 secs.
Interestingly, the working set remained fairly small (<1GB) so the
system wasn't thrashing (though ZFS was very unhappy).

>This is probably one of those ridiculous optimizer bugs like what
>happened with x11-servers/xorg-server back in the day when 4.2.1 was
>initially imported...


It's probably a "well, don't do that then" case but if someone feels
like chasing it down, I won't object.

-- 
Peter Jeremy
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:41 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 Tobias C. Berner freebsd_committer freebsd_triage 2019-03-16 12:05:19 UTC
Qt4 and with it devel/qt4-script will be removed today.