Bug 16239 - GCC 3.4.0 ICE on ppc64 (mozilla 1.7 compile, -O1 -fno-exceptions issue)
Summary: GCC 3.4.0 ICE on ppc64 (mozilla 1.7 compile, -O1 -fno-exceptions issue)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-06-28 02:23 UTC by Brad House
Modified: 2004-07-27 01:54 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc64-*-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-07-24 22:36:32


Attachments
gzipped g++ -E output of file that creates ICE (126.88 KB, application/octet-stream)
2004-06-28 02:24 UTC, Brad House
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brad House 2004-06-28 02:23:27 UTC
ICE on compile.  Seems to be an issue with -O1 and -fno-exceptions
on this particular mozilla file (at least that's what I've narrowed
it down to).  I've attached the pre-processed g++ -E output.
It's using Gentoo's GCC 3.4.0-r6 ebuild, Tom Gall @ IBM told me to
post, so blame him. :)

Below are compile lines and info:

*****************************
Full output from bad compile:
*****************************

g++ -o nsXULContentBuilder.o -c -DOSTYPE=\"Linux2.6\" -DOSARCH=\"Linux\"
-D_IMPL_NS_LAYOUT -I./../../../base/src -I./../../content/src 
-I../../../../dist/include/xpcom -I../../../../dist/include/string
-I../../../../dist/include/js -I../../../../dist/include/xpconnect
-I../../../../dist/include/caps -I../../../../dist/include/gfx
-I../../../../dist/include/htmlparser -I../../../../dist/include/layout
-I../../../../dist/include/content -I../../../../dist/include/widget
-I../../../../dist/include/dom -I../../../../dist/include/rdf
-I../../../../dist/include/necko -I../../../../dist/include/locale
-I../../../../dist/include/unicharutil -I../../../../dist/include/xul
-I../../../../dist/include/xuldoc -I../../../../dist/include/webshell
-I../../../../dist/include/xultmpl -I../../../../dist/include
-I/var/tmp/portage/mozilla-1.7/work/mozilla/dist/include/nspr    
-I/usr/X11R6/include   -fPIC  -I/usr/X11R6/include -fno-rtti -fno-exceptions
-Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth
-Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -mminimal-toc
-fno-strict-aliasing -Wno-deprecated -fshort-wchar -pthread -pipe  -DNDEBUG
-DTRIMMED -ffunction-sections -O1 -g  -I/usr/X11R6/include -DMOZILLA_CLIENT
-include ../../../../mozilla-config.h -Wp,-MD,.deps/nsXULContentBuilder.pp
nsXULContentBuilder.cpp
In file included from ./../../content/src/nsXULElement.h:64,
                 from nsXULContentBuilder.cpp:70:
../../../../dist/include/dom/nsIDOMXULSelectCntrlEl.h:33: warning: `virtual
nsresult
nsIDOMXULSelectControlElement::GetSelectedItem(nsIDOMXULSelectControlItemElement**)'
was hidden
../../../../dist/include/dom/nsIDOMXULMultSelectCntrlEl.h:69: warning:   by
`virtual nsresult nsIDOMXULMultiSelectControlElement::GetSelectedItem(PRInt32,
nsIDOMXULSelectControlItemElement**)'
nsXULTemplateBuilder.h:94: warning: `virtual nsresult
nsXULTemplateBuilder::Init(nsIContent*)' was hidden
nsXULContentBuilder.cpp:146: warning:   by `nsresult nsXULContentBuilder::Init()'
nsXULContentBuilder.cpp: In member function `nsresult
nsXULContentBuilder::BuildContentFromTemplate(nsIContent*, nsIContent*,
nsIContent*, PRBool, nsIRDFResource*, PRBool, nsTemplateMatch*, nsIContent**,
PRInt32*)':
nsXULContentBuilder.cpp:85: error: insn does not satisfy its constraints:
(insn 6646 6645 6534 78 (set (reg/v/f:DI 63 31 [orig:978 data ] [978])
        (plus:DI (reg/v/f:DI 63 31 [orig:978 data ] [978])
            (const_int 232 [0xe8]))) 233 {*adddi3_internal1} (nil)
    (expr_list:REG_EQUIV (plus:DI (reg/f:DI 1 1)
            (const_int 232 [0xe8]))
        (nil)))
nsXULContentBuilder.cpp:85: internal compiler error: in
reload_cse_simplify_operands, at postreload.c:378
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccLIxm5i.out file, please attach this to
your bugreport.



*******************************************
Full Compile command for pre-processed code
*******************************************

g++ -O1 -fPIC -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith
-Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy
-Wno-non-virtual-dtor -Wno-long-long -mminimal-toc -fno-strict-aliasing
-Wno-deprecated -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED
-ffunction-sections -Wp,-MD,.deps/nsXULContentBuilder.pp -o
/tmp/nsXULContentBuilder.o -c /tmp/nsXULContentBuilder.CPP




********************************************
Bad option is -fno-exceptions
BUT ONLY IF -O1 is specified with it
-O2 does NOT exhibit the issue
********************************************

ppc64 src # g++  -fno-exceptions -o /tmp/nsXULContentBuilder.o -c
/tmp/nsXULContentBuilder.CPP
ppc64 src # g++ -O2 -fno-exceptions -o /tmp/nsXULContentBuilder.o -c
/tmp/nsXULContentBuilder.CPP
ppc64 src # g++ -O1 -fno-exceptions -o /tmp/nsXULContentBuilder.o -c
/tmp/nsXULContentBuilder.CPP
nsXULContentBuilder.cpp: In member function `nsresult
nsXULContentBuilder::BuildContentFromTemplate(nsIContent*, nsIContent*,
nsIContent*, PRBool, nsIRDFResource*, PRBool, nsTemplateMatch*, nsIContent**,
PRInt32*)':
nsXULContentBuilder.cpp:825: error: insn does not satisfy its constraints:
(insn 6646 6645 6535 78 (set (reg/v/f:DI 63 31 [orig:979 data ] [979])
        (plus:DI (reg/v/f:DI 63 31 [orig:979 data ] [979])
            (const_int 232 [0xe8]))) 233 {*adddi3_internal1} (nil)
    (expr_list:REG_EQUIV (plus:DI (reg/f:DI 1 1)
            (const_int 232 [0xe8]))
        (nil)))
nsXULContentBuilder.cpp:825: internal compiler error: in
reload_cse_simplify_operands, at postreload.c:378
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccNgrrOI.out file, please attach this to
your bugreport.
Comment 1 Brad House 2004-06-28 02:24:37 UTC
Created attachment 6639 [details]
gzipped g++ -E output of file that creates ICE
Comment 2 Andrew Pinski 2004-06-28 02:30:06 UTC
Is this reproducable on an FSF released version of gcc?
Comment 3 Andrew Pinski 2004-06-28 02:33:07 UTC
If it not reproducable on a FSF released version of gcc why are you reporting it to here then first, try 
gentoo first since they are the ones who provided you with the compiler and their address is the bug 
address.
Comment 4 Tom Gall 2004-06-28 02:39:16 UTC
Alan Modra asked us to report it here. Given that the ppc64 3.4.0-r6 compiler
and FSF 3.4.0 aren't that far apart I don't think this is an unreasonable report
Comment 5 Brad House 2004-06-28 02:41:22 UTC
I can pull in the sources and try it, though it probably won't be until
tomorrow.  I would seriously doubt it's specific to the minimal set of
patches gentoo applies (they're not quite as bad as redhat), but anyhow,
this is specific to ppc64 (none of the other arches have exhibited this 
behavior), and there is only one ppc64 gentoo dev at the moment which
has not committed any ppc64 specific patches to gcc...

Let me know if this is a must to try an unpatched version, and I'll
compile gcc by hand.

-Brad
Comment 6 Andrew Pinski 2004-06-28 05:17:16 UTC
Note actually RedHat's 3.4 only has a small patches over 3.4, you can see that from their branch in the 
FSF's cvs.  I seem to remember that Gentoo adds propolice to gcc so that is what I thought might cause 
this problem.
Comment 7 Brad House 2004-06-28 14:48:10 UTC
Ok, it is definitely reproducable on vanilla GCC 3.4.0 :

ppc64 objdir # gcc -v
Reading specs from /usr/local/gcc/lib/gcc/powerpc64-unknown-linux-gnu/3.4.0/specs
Configured with: ../gcc-3.4.0/configure --prefix=/usr/local/gcc --enable-shared
--host=powerpc64-unknown-linux-gnu --target=powerpc64-unknown-linux-gnu
--with-system-zlib --enable-languages=c,c++ --enable-threads=posix
--enable-long-long --disable-checking --disable-libunwind-exceptions
--enable-cstdio=stdio --enable-version-specific-runtime-libs --disable-werror
--enable-shared --enable-nls --without-included-gettext --disable-multilib
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix


ppc64 objdir # g++ -O1 -fno-exceptions -o /tmp/nsXULContentBuilder.o -c
/tmp/nsXULContentBuilder.CPP
nsXULContentBuilder.cpp: In member function `nsresult
nsXULContentBuilder::BuildContentFromTemplate(nsIContent*, nsIContent*,
nsIContent*, PRBool, nsIRDFResource*, PRBool, nsTemplateMatch*, nsIContent**,
PRInt32*)':
nsXULContentBuilder.cpp:825: error: insn does not satisfy its constraints:
(insn 6646 6645 6535 78 (set (reg/v/f:DI 63 31 [orig:979 data ] [979])
        (plus:DI (reg/v/f:DI 63 31 [orig:979 data ] [979])
            (const_int 232 [0xe8]))) 233 {*adddi3_internal1} (nil)
    (expr_list:REG_EQUIV (plus:DI (reg/f:DI 1 1)
            (const_int 232 [0xe8]))
        (nil)))
nsXULContentBuilder.cpp:825: internal compiler error: in
reload_cse_simplify_operands, at postreload.c:378
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 8 David Edelsohn 2004-07-24 22:36:31 UTC
The problem is that GCC's reload phase is choosing an FPR to hold a DImode
address and then tries to add a constant to the value in the FPR.  The DImode
addition pattern only handles GPRs, so the constraint does not match the
predicate.  Restricting the predicate does not work because reload already has
chosen the reload register before it checks the predicate and fails another way.
 It looks like the fix will require convincing reload not to use an FPR for a
DImode address.

The more basic question is why is gentoo trying to build Mozilla as a 64-bit app?
Comment 9 GCC Commits 2004-07-27 01:51:52 UTC
Subject: Bug 16239

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	dje@gcc.gnu.org	2004-07-27 01:51:44

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

Log message:
	PR target/16239
	* config/rs6000/rs6000.md (movdi_internal64): Further disparage
	f->f.

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.567&r2=2.2326.2.568
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.11&r2=1.284.4.12

Comment 10 GCC Commits 2004-07-27 01:52:57 UTC
Subject: Bug 16239

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dje@gcc.gnu.org	2004-07-27 01:52:53

Modified files:
	gcc            : ChangeLog 

Log message:
	- note PR target/16239 in previous rs6000.md ChangeLog entry.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4703&r2=2.4704

Comment 11 David Edelsohn 2004-07-27 01:54:12 UTC
Patch committed to mainline and gcc-3.4 branch.
Comment 12 GCC Commits 2005-01-05 09:17:16 UTC
Subject: Bug 16239

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_2-rhl8-branch
Changes by:	jakub@gcc.gnu.org	2005-01-05 09:17:00

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.md 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr8328.c 

Log message:
	2004-07-25  David Edelsohn  <edelsohn@gnu.org>
	
	PR target/16239
	* config/rs6000/rs6000.md (movdi_internal64): Further disparage
	f->f.
	
	2002-11-06  David Edelsohn  <edelsohn@gnu.org>
	
	PR target/8480, optimization/8328
	* config/rs6000/rs6000.md (movdi_internal64): Discourage
	FPR to FPR moves.
	
	2004-12-22  Ben Elliston  <bje@au.ibm.com>
	
	PR optimization/8328
	* gcc.dg/pr8328.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.13152.2.657.2.27.2.208&r2=1.13152.2.657.2.27.2.209
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.md.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.170.2.11.4.12&r2=1.170.2.11.4.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.1672.2.166.2.8.2.89&r2=1.1672.2.166.2.8.2.90
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr8328.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=NONE&r2=1.1.2.1