Bug 782868

Summary: gcc-4.7 ICE while compiling LLVM
Product: [Fedora] Fedora Reporter: Karsten Hopp <karsten>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: bergner, jakub
Target Milestone: ---   
Target Release: ---   
Hardware: powerpc   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-4.7.0-0.9.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-24 07:42:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
preprocessed source
none
rh782868.ii none

Description Karsten Hopp 2012-01-18 18:19:43 UTC
Description of problem:
http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=357072 shows an internal compiler error while building llvm. This is reproducable with a  llvm-3.0-1.fc17 build.

Version-Release number of selected component (if applicable):
gcc-4.7.0-0.7.fc17.ppc64

How reproducible:
always

Steps to Reproduce:
1. ppc-koji build --scratch f17 llvm-3.0-1.fc17.src.rpm

  
Actual results:
http://ppc.koji.fedoraproject.org/koji/getfile?taskID=357074&name=build.log

Additional info:
I've reproduced it on power05, you can get to it with
 mock -r fedora-rawhide-ppc64 --uniqueext=kh shell
 cd /builddir/build/BUILD/llvm-3.0.src/lib/CodeGen/SelectionDAG
 g++ -I/builddir/build/BUILD/llvm-3.0.src/include -I/builddir/build/BUILD/llvm-3.0.src/lib/CodeGen/SelectionDAG  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual    -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings  -c -MMD -MP -MF "/builddir/build/BUILD/llvm-3.0.src/lib/CodeGen/SelectionDAG/Release/DAGCombiner.d.tmp" -MT "/builddir/build/BUILD/llvm-3.0.src/lib/CodeGen/SelectionDAG/Release/DAGCombiner.o" -MT "/builddir/build/BUILD/llvm-3.0.src/lib/CodeGen/SelectionDAG/Release/DAGCombiner.d" DAGCombiner.cpp -o /builddir/build/BUILD/llvm-3.0.src/lib/CodeGen/SelectionDAG/Release/DAGCombiner.o

Comment 1 Karsten Hopp 2012-01-18 18:23:06 UTC
Created attachment 556089 [details]
preprocessed source

Comment 2 Peter Bergner 2012-01-18 19:20:55 UTC
Confirmed and it ICE's with gcc mainline too.  I'll have a closer look.

Comment 3 Jakub Jelinek 2012-01-18 22:53:40 UTC
Created attachment 556129 [details]
rh782868.ii

Slightly reduced testcase for -O2 -m64.

Comment 4 Peter Bergner 2012-01-18 23:48:54 UTC
We ICE when we try and do a BLK move from a reg:TI.  This seems to fix it:

Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	(revision 183280)
+++ gcc/emit-rtl.c	(working copy)
@@ -1401,6 +1401,9 @@ operand_subword (rtx op, unsigned int of
 	return replace_equiv_address (new_rtx, XEXP (new_rtx, 0));
     }
 
+  if (REG_P (op) && mode == BLKmode)
+    mode = GET_MODE (op);
+
   /* Rest can be handled by simplify_subreg.  */
   return simplify_gen_subreg (word_mode, op, mode, (offset * UNITS_PER_WORD));
 }

In GCC 4.6, we don't go down this path, because we fail the load_register_parameters() test:

   else if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode)

I'll bootstrap/regtest the patch above.