public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/46664] New: Failed to build 481.wrf in SPEC CPU 2006 with LTO
@ 2010-11-25 21:38 hjl.tools at gmail dot com
  2010-11-25 22:05 ` [Bug lto/46664] " hjl.tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2010-11-25 21:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46664

           Summary: Failed to build 481.wrf in SPEC CPU 2006 with LTO
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com


On Linux/ia32, when building 481.wrf in SPEC CPU 2006,
revision 167136 gave:

gfortran -m32  -O2 -msse2 -mfpmath=sse -ffast-math -fwhole-program
-flto=jobserver -fuse-linker-plugin  -DSPEC_CPU_LINUX -DSPEC_CPU_CASE_FLAG
-DSPEC_CPU_LOGICAL_STRICT -frecord-marker=4   .....
In file included from :12:0:
solve_em.fppized.f90: In function 'solve_em':
solve_em.fppized.f90:3:0: internal compiler error: in build2_stat, at
tree.c:3798
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[4]: *** [/tmp/ccJOwF7W.ltrans2.ltrans.o] Error 1
lto-wrapper: make returned 2 exit status
lto-wrapper failedcollect2: ld returned 1 exit status
specmake[3]: *** [wrf] Error 1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/46664] Failed to build 481.wrf in SPEC CPU 2006 with LTO
  2010-11-25 21:38 [Bug lto/46664] New: Failed to build 481.wrf in SPEC CPU 2006 with LTO hjl.tools at gmail dot com
@ 2010-11-25 22:05 ` hjl.tools at gmail dot com
  2010-11-26 10:29 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2010-11-25 22:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46664

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-25 20:44:14 UTC ---
With testcase at

http://www.kernel.org/pub/linux/devel/gcc/lto/wrf.ltrans2.o.gz

I got

[hjl@gnu-4 build_base_lto.0000]$
/export/gnu/import/svn/gcc-test-spec/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto1
-quiet -dumpdir ./ -dumpbase wrf.ltrans2 -m32 -msse2 -mfpmath=sse
-mtune=generic -march=x86-64 -auxbase-strip wrf.ltrans2.ltrans.o -O2 -version
-ffast-math -fwhole-program -fuse-linker-plugin -frecord-marker=4 -fltrans
wrf.ltrans2.o -o wrf.ltrans2.s
GNU GIMPLE (GCC) version 4.6.0 20101124 (experimental) [trunk revision 167110]
(x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.6.0 20101124 (experimental) [trunk revision
167110], GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.6.0 20101124 (experimental) [trunk revision 167110]
(x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.6.0 20101124 (experimental) [trunk revision
167110], GMP version 4.3.2, MPFR version 2.4.2-p3, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
In file included from :12:0:
solve_em.fppized.f90: In function \u2018solve_em\u2019:
solve_em.fppized.f90:3:0: internal compiler error: in build2_stat, at
tree.c:3798
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-4 build_base_lto.0000]$ 

(gdb) bt
#0  fancy_abort (file=0xcf1141 "../../src-trunk/gcc/tree.c", line=3798, 
    function=0xcf5adf "build2_stat") at ../../src-trunk/gcc/diagnostic.c:892
#1  0x00000000008eb0d6 in build2_stat (code=POINTER_PLUS_EXPR, 
    tt=0x7ffff01cfc78, arg0=0x7fffef35f090, arg1=0x7fffef35f0c0)
    at ../../src-trunk/gcc/tree.c:3796
#2  0x00000000005e9919 in fold_build2_stat_loc (loc=0, code=POINTER_PLUS_EXPR, 
    type=0x7ffff01cfc78, op0=0x7fffef35f090, op1=0x7fffef35f0c0)
    at ../../src-trunk/gcc/fold-const.c:14081
#3  fold_build2_stat_loc (loc=0, code=POINTER_PLUS_EXPR, type=0x7ffff01cfc78, 
    op0=0x7fffef35f090, op1=0x7fffef35f0c0)
    at ../../src-trunk/gcc/fold-const.c:14053
#4  0x0000000000be191e in aff_combination_to_tree (comb=0x7fffffffd530)
    at ../../src-trunk/gcc/tree-affine.c:447
#5  0x0000000000840d7f in get_loop_invariant_expr_id (data=0x7fffffffd8b0, 
    use=<value optimized out>, cand=<value optimized out>, address_p=0 '\000', 
    depends_on=0x7fffffffd6d8, at=<value optimized out>, can_autoinc=0x0, 
    inv_expr_id=0x7fffffffd708)
    at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:3932
#6  get_computation_cost_at (data=0x7fffffffd8b0, use=<value optimized out>, 
    cand=<value optimized out>, address_p=0 '\000', depends_on=0x7fffffffd6d8, 
    at=<value optimized out>, can_autoinc=0x0, inv_expr_id=0x7fffffffd708)
    at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:4102
#7  0x0000000000842bbd in get_computation_cost (data=0x7fffffffd8b0, 
---Type <return> to continue, or q <return> to quit---
    use=0x2473f00, cand=0x2473fd0)
    at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:4182
#8  determine_use_iv_cost_generic (data=0x7fffffffd8b0, use=0x2473f00, 
    cand=0x2473fd0) at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:4209
#9  determine_use_iv_cost (data=0x7fffffffd8b0, use=0x2473f00, cand=0x2473fd0)
    at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:4501
#10 0x0000000000843109 in determine_use_iv_costs (data=0x7fffffffd8b0)
    at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:4607
#11 0x0000000000843b58 in tree_ssa_iv_optimize_loop (data=0x7fffffffd8b0, 
    loop=<value optimized out>)
    at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:6391
#12 0x0000000000845517 in tree_ssa_iv_optimize ()
    at ../../src-trunk/gcc/tree-ssa-loop-ivopts.c:6438
#13 0x000000000084fef7 in tree_ssa_loop_ivopts ()
    at ../../src-trunk/gcc/tree-ssa-loop.c:657
#14 0x00000000006d5b1f in execute_one_pass (pass=0x1163980)
    at ../../src-trunk/gcc/passes.c:1564
#15 0x00000000006d5de5 in execute_pass_list (pass=0x1163980)
    at ../../src-trunk/gcc/passes.c:1619
#16 0x00000000006d5df7 in execute_pass_list (pass=0x1163fe0)
    at ../../src-trunk/gcc/passes.c:1620
#17 0x00000000006d5df7 in execute_pass_list (pass=0x11631a0)
    at ../../src-trunk/gcc/passes.c:1620
---Type <return> to continue, or q <return> to quit---
#18 0x00000000007cc156 in tree_rest_of_compilation (fndecl=0x7ffff1b16e00)
    at ../../src-trunk/gcc/tree-optimize.c:422
#19 0x000000000096be42 in cgraph_expand_function (node=0x7ffff0dd2840)
    at ../../src-trunk/gcc/cgraphunit.c:1494
#20 0x000000000096e41a in cgraph_expand_all_functions ()
    at ../../src-trunk/gcc/cgraphunit.c:1553
#21 cgraph_optimize () at ../../src-trunk/gcc/cgraphunit.c:1809
#22 0x00000000004b8288 in lto_main () at ../../src-trunk/gcc/lto/lto.c:2468
#23 0x0000000000775e84 in compile_file (argc=23, argv=0x7fffffffdd78)
    at ../../src-trunk/gcc/toplev.c:806
#24 do_compile (argc=23, argv=0x7fffffffdd78)
    at ../../src-trunk/gcc/toplev.c:2206
#25 toplev_main (argc=23, argv=0x7fffffffdd78)
    at ../../src-trunk/gcc/toplev.c:2269
#26 0x0000003cfd21ee7d in __libc_start_main () from /lib64/libc.so.6
#27 0x000000000049f1d5 in _start ()
(gdb) f 1
#1  0x00000000008eb0d6 in build2_stat (code=POINTER_PLUS_EXPR, 
    tt=0x7ffff01cfc78, arg0=0x7fffef35f090, arg1=0x7fffef35f0c0)
    at ../../src-trunk/gcc/tree.c:3796
3796        gcc_assert (POINTER_TYPE_P (tt) && POINTER_TYPE_P (TREE_TYPE
(arg0))
(gdb) call debug_tree (arg0)
 <nop_expr 0x7fffef35f090
    type <integer_type 0x7ffff1c23000 public unsigned sizetype SI
        size <integer_cst 0x7ffff1c13708 constant 32>
        unit size <integer_cst 0x7ffff1c13410 constant 4>
        align 32 symtab 0 alias set -1 structural equality precision 32 min
<integer_cst 0x7ffff1c13730 0> max <integer_cst 0x7ffff1c13a50 -1>>

    arg 0 <ssa_name 0x7ffff01e7318
        type <pointer_type 0x7ffff1c23dc8 type <void_type 0x7ffff1c23d20>
            public unsigned SI size <integer_cst 0x7ffff1c13708 32> unit size
<integer_cst 0x7ffff1c13410 4>
            align 32 symtab 0 alias set -1 structural equality
            pointer_to_this <pointer_type 0x7ffff1c34bd0>>
        visited var <var_decl 0x7ffff01de8c0 D.36049>def_stmt D.36049_17926 =
__builtin_malloc (D.36050_17925);

        version 17926
        ptr-info 0x7ffff090bb40>>
(gdb) call debug_tree (tt)
 <pointer_type 0x7ffff01cfc78
    type <array_type 0x7ffff01cfa80
        type <real_type 0x7ffff1c30000 SF
            size <integer_cst 0x7ffff1c13708 constant 32>
            unit size <integer_cst 0x7ffff1c13410 constant 4>
            align 32 symtab 0 alias set -1 structural equality precision 32
            pointer_to_this <pointer_type 0x7ffff1c301f8> reference_to_this
<reference_type 0x7ffff16e41f8>>
        BLK
        size <var_decl 0x7ffff01d3460 D.35767 type <integer_type 0x7ffff1c230a8
bit_size_type>
            used unsigned ignored DI file module_diffusion_em.fppized.f90 line
2257 col 0
            size <integer_cst 0x7ffff1c13870 constant 64>
            unit size <integer_cst 0x7ffff1c13898 constant 8>
            align 64 context <function_decl 0x7ffff1b16e00 solve_em>
abstract_origin <var_decl 0x7ffff0daf960 D.20400>>
        unit size <var_decl 0x7ffff01d3500 D.35768 type <integer_type
0x7ffff1c23000>
            used unsigned ignored SI file module_diffusion_em.fppized.f90 line
2257 col 0 size <integer_cst 0x7ffff1c13708 32> unit size <integer_cst
0x7ffff1c13410 4>
            align 32 context <function_decl 0x7ffff1b16e00 solve_em>
abstract_origin <var_decl 0x7ffff0dafa00 D.20401>>
        align 32 symtab 0 alias set -1 canonical type 0x7ffff0db15e8
        domain <integer_type 0x7ffff01cfb28 type <integer_type 0x7ffff1c23498>
            SI size <integer_cst 0x7ffff1c13708 32> unit size <integer_cst
0x7ffff1c13410 4>
            align 32 symtab 0 alias set -1 canonical type 0x7ffff0db1690
precision 32 min <integer_cst 0x7ffff1c13c58 0> max <var_decl 0x7ffff01d33c0
D.35766>>
        pointer_to_this <pointer_type 0x7ffff01cfbd0>>
    public unsigned restrict SI size <integer_cst 0x7ffff1c13708 32> unit size
<integer_cst 0x7ffff1c13410 4>
    align 32 symtab 0 alias set -1 canonical type 0x7ffff0db1540>
(gdb)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/46664] Failed to build 481.wrf in SPEC CPU 2006 with LTO
  2010-11-25 21:38 [Bug lto/46664] New: Failed to build 481.wrf in SPEC CPU 2006 with LTO hjl.tools at gmail dot com
  2010-11-25 22:05 ` [Bug lto/46664] " hjl.tools at gmail dot com
@ 2010-11-26 10:29 ` rguenth at gcc dot gnu.org
  2010-11-26 11:33 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-26 10:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46664

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-26 10:13:45 UTC ---
It looks like swapped arguments - fold_binary should have gone by here:

      /* index +p PTR -> PTR +p index */
      if (POINTER_TYPE_P (TREE_TYPE (arg1))
          && INTEGRAL_TYPE_P (TREE_TYPE (arg0)))
        return fold_build2_loc (loc, POINTER_PLUS_EXPR, type,
                            fold_convert_loc (loc, type, arg1),
                            fold_convert_loc (loc, sizetype, arg0));

and fix it up.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/46664] Failed to build 481.wrf in SPEC CPU 2006 with LTO
  2010-11-25 21:38 [Bug lto/46664] New: Failed to build 481.wrf in SPEC CPU 2006 with LTO hjl.tools at gmail dot com
  2010-11-25 22:05 ` [Bug lto/46664] " hjl.tools at gmail dot com
  2010-11-26 10:29 ` rguenth at gcc dot gnu.org
@ 2010-11-26 11:33 ` rguenth at gcc dot gnu.org
  2010-11-26 13:24 ` rguenth at gcc dot gnu.org
  2010-11-26 13:39 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-26 11:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46664

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.11.26 11:23:10
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-26 11:23:10 UTC ---
Confirmed.  My gold also complains:

/var.o netcdf/typeSizes.o netcdf/netcdf.o                     -o wrf
/usr/bin/gold: error: module_physics_init.fppized.o: multiple definition of
'module_ra_gfdleta.eq.0_'
/usr/bin/gold: module_ra_gfdleta.fppized.o: previous definition here
/usr/bin/gold: error: module_physics_init.fppized.o: multiple definition of
'module_ra_gfdleta.eq.1_'
/usr/bin/gold: module_ra_gfdleta.fppized.o: previous definition here
/usr/bin/gold: error: module_physics_init.fppized.o: multiple definition of
'module_ra_gfdleta.eq.2_'
...
In file included from :12:0:
solve_em.fppized.f90: In function 'solve_em':
solve_em.fppized.f90:3:0: internal compiler error: in build2_stat, at
tree.c:3798
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [/tmp/cc4pERit.ltrans2.ltrans.o] Error 1

In the end it is because we have

{
  type = <float:32>[0:D.35766] * restrict
  offset = 0
  elements = {
    [0] = D.36037_17957 * 1, 
    [1] = (lbound.2168_17368 + 1) * stride.2022_17908 * 8, 
    [2] = stride.2025_17914 * j_18060 * 4, 
    [3] = offset.2026_17932 * 4, 
    [4] = lbound.2168_17368 * stride.2022_17908 * -4, 
    [5] = (j_18060 + -1) * stride.2025_17914 * -4, 
    [6] = D.36025_17988 * -1, 
    [7] = i_18065 * 4
  }
  rest = (<unnamed-unsigned:32>) D.36049_17926
}

and D.36049_17926 is a pointer.  Thus, the affine comb is of pointer type
but there is no pointer element.

We are adding

{
  type = <float:32>[0:D.35766] * restrict
  offset = 0
  elements = {
    [0] = D.36037_17957 * 1, (void *)
    [1] = (lbound.2168_17368 + 1) * stride.2022_17908 * 4, (int)
    [2] = stride.2025_17914 * j_18060 * 4, (int)
    [3] = offset.2026_17932 * 4 (int)
  }
}

and

{
  type = <unnamed-unsigned:32>
  offset = 0
  elements = {
    [0] = lbound.2168_17368 * stride.2022_17908 * -1,  (int)
    [1] = (j_18060 + -1) * stride.2025_17914 * -1,  (int)
    [2] = D.36025_17988 * -1,  (void *)
    [3] = i_18065 * 4,  (int)
    [4] = D.36049_17926 * 1,  (void *)
    [5] = (lbound.2168_17368 + 1) * stride.2022_17908 * 4  (int)
  }
}

Adding D.36049_17926 we add it to ->rest of

{
  type = <float:32>[0:D.35766] * restrict
  offset = 0
  elements = {
    [0] = D.36037_17957 * 1, 
    [1] = (lbound.2168_17368 + 1) * stride.2022_17908 * 4, 
    [2] = stride.2025_17914 * j_18060 * 4, 
    [3] = offset.2026_17932 * 4, 
    [4] = lbound.2168_17368 * stride.2022_17908 * -4, 
    [5] = (j_18060 + -1) * stride.2025_17914 * -4, 
    [6] = D.36025_17988 * -1, 
    [7] = i_18065 * 4
  }
}

because we overflow MAX_AFF_ELTS and hit

  type = comb->type;
  if (POINTER_TYPE_P (type))
    type = sizetype;

which means ->rest will be always of sizetype which is inconsistent
with what aff_combination_to_tree does.

It sounds more natural to not start aff_combination_to_tree with
->rest but instead add that last, before adding ->offset.  That fixes
the ICE.

Mine.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/46664] Failed to build 481.wrf in SPEC CPU 2006 with LTO
  2010-11-25 21:38 [Bug lto/46664] New: Failed to build 481.wrf in SPEC CPU 2006 with LTO hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2010-11-26 11:33 ` rguenth at gcc dot gnu.org
@ 2010-11-26 13:24 ` rguenth at gcc dot gnu.org
  2010-11-26 13:39 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-26 13:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46664

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-26 12:42:47 UTC ---
Author: rguenth
Date: Fri Nov 26 12:42:41 2010
New Revision: 167173

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167173
Log:
2010-11-26  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/46664
    * tree-affine.c (aff_combination_to_tree): Add rest last.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-affine.c


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug lto/46664] Failed to build 481.wrf in SPEC CPU 2006 with LTO
  2010-11-25 21:38 [Bug lto/46664] New: Failed to build 481.wrf in SPEC CPU 2006 with LTO hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2010-11-26 13:24 ` rguenth at gcc dot gnu.org
@ 2010-11-26 13:39 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-26 13:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46664

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-26 12:43:30 UTC ---
Fixed for 4.6.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-11-26 12:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-25 21:38 [Bug lto/46664] New: Failed to build 481.wrf in SPEC CPU 2006 with LTO hjl.tools at gmail dot com
2010-11-25 22:05 ` [Bug lto/46664] " hjl.tools at gmail dot com
2010-11-26 10:29 ` rguenth at gcc dot gnu.org
2010-11-26 11:33 ` rguenth at gcc dot gnu.org
2010-11-26 13:24 ` rguenth at gcc dot gnu.org
2010-11-26 13:39 ` rguenth at gcc dot gnu.org

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