[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread rguenth at gcc dot gnu.org


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



--- Comment #9 from Richard Biener  2013-03-08 
13:46:35 UTC ---

Author: rguenth

Date: Fri Mar  8 13:46:18 2013

New Revision: 196546



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196546

Log:

2013-03-08  Richard Biener  



PR tree-optimization/56570

* tree-cfg.c (verify_expr_location_1): Verify locations for

DECL_DEBUG_EXPR.

* tree-sra.c (create_access_replacement): Strip locations

from DECL_DEBUG_EXPRs.



Modified:

trunk/gcc/ChangeLog

trunk/gcc/tree-cfg.c

trunk/gcc/tree-sra.c


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread rguenth at gcc dot gnu.org


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



Richard Biener  changed:



   What|Removed |Added



 Status|NEW |RESOLVED

 Resolution||FIXED



--- Comment #10 from Richard Biener  2013-03-08 
13:46:57 UTC ---

Fixed.


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread rguenth at gcc dot gnu.org


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



--- Comment #8 from Richard Biener  2013-03-08 
12:42:12 UTC ---

We don't even copy the decl with the DECL_DEBUG_EXPR in copy_debug_stmt during

the 2nd inlining!  Because when the decls disappear from local-decls nothing

remaps them and we get into



  else if (TREE_CODE (t) == VAR_DECL

   && !is_global_var (t)

   && !pointer_map_contains (id->decl_map, t))

/* T is a non-localized variable.  */;



so we absolutely rely on being able to share DECL_DEBUG_EXPR for those!



Thus, the SRA patch is correct and verification should be made even stricter.


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread rguenth at gcc dot gnu.org


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



--- Comment #7 from Richard Biener  2013-03-08 
12:25:50 UTC ---

Created attachment 29620

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29620

inliner patches



For the inliner I've now synced copy_tree_body_r and remap_gimple_op_r wrt

MEM_REFs (to no avail).  I also added debug-expr remapping to copy_debug_stmt

(as the tree-ssa-live.c code shows not all debug-expr decls are in

local-decls),

to no avail either.



See attachment.


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread jakub at gcc dot gnu.org


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



--- Comment #6 from Jakub Jelinek  2013-03-08 
12:15:38 UTC ---

Locations are useless in DECL_DEBUG_EXPR expressions, so I have nothing against

that SRA change, but please note that also gimplify.c and tree-complex.c create

DECL_DEBUG_EXPRs, so those places should be investigated too.

In gimplify.c sounds like *to_p is always DECL_P though, and in tree-complex.c

REALPART_EXPR or IMAGPART_EXPR of a DECL_P where the expr is created with

build1 (thus doesn't have loc?).


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread rguenth at gcc dot gnu.org


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



--- Comment #5 from Richard Biener  2013-03-08 
12:15:13 UTC ---

typedef struct { unsigned long long w[4]; } UINT256;

static void add256 (UINT256 x, UINT256 y, UINT256 * pz)

{

UINT256 z;

z.w[0] = x.w[0] + y.w[0];

z.w[1] = x.w[1] + y.w[1];

z.w[2] = x.w[2] + y.w[2];

z.w[3] = x.w[3] + y.w[3];

*pz = z;

}

static inline void bid128_ext_fma ()

{

  UINT256 C4;

  UINT256 R256;

  add256 (C4, R256, &R256);

  nr_digits256 (R256);

}

void __bid128_fma ()

{

  bid128_ext_fma ();

}





ICEs at -O2 -g -m32 with the extra checking.


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread rguenth at gcc dot gnu.org


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



--- Comment #4 from Richard Biener  2013-03-08 
12:05:41 UTC ---

It's the DECL_DEBUG_EXPRs created by SRA, supposedly we can fix it by



Index: tree-sra.c

===

--- tree-sra.c  (revision 196487)

+++ tree-sra.c  (working copy)

@@ -1917,7 +1917,7 @@ create_access_replacement (struct access

   && !DECL_ARTIFICIAL (access->base))

 {

   char *pretty_name = make_fancy_name (access->expr);

-  tree debug_expr = unshare_expr (access->expr), d;

+  tree debug_expr = unshare_expr_without_location (access->expr), d;

   bool fail = false;



   DECL_NAME (repl) = get_identifier (pretty_name);



but we should fix the reason why it doesn't survive inlining properly.



Reducing a file from libgcc instead.


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread rguenth at gcc dot gnu.org


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



Richard Biener  changed:



   What|Removed |Added



 Status|UNCONFIRMED |NEW

   Last reconfirmed||2013-03-08

 Ever Confirmed|0   |1



--- Comment #3 from Richard Biener  2013-03-08 
11:20:22 UTC ---

Index: gcc/tree-cfg.c

===

--- gcc/tree-cfg.c  (revision 196540)

+++ gcc/tree-cfg.c  (working copy)

@@ -4521,6 +4541,15 @@ verify_expr_location_1 (tree *tp, int *w

 {

   struct pointer_set_t *blocks = (struct pointer_set_t *) data;



+  if (TREE_CODE (*tp) == VAR_DECL

+  && DECL_DEBUG_EXPR_IS_FROM (*tp))

+{

+  tree t = DECL_DEBUG_EXPR (*tp);

+  tree addr = walk_tree (&t, verify_expr_location_1, blocks, NULL);

+  if (addr)

+   return addr;

+}

+

   if (!EXPR_P (*tp))

 {

   *walk_subtrees = false;





exposes it.  Various fixes to tree-inline.c didn't yet fix it :/



Reducing the testcase with the above.


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread jamborm at gcc dot gnu.org


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



--- Comment #2 from Martin Jambor  2013-03-08 
10:43:12 UTC ---

I forgot the compilation options I use:



~/gcc/trunk/inst/bin/g++ -o CodeGenerator-shared.o -c -fPIC 

-Wno-invalid-offsetof -Wcast-align -flto -fpermissive -Wno-maybe-uninitialized

-Wno-unused-local-typedefs -fuse-linker-plugin -fno-rtti -ffunction-sections

-fdata-sections -fno-exceptions -pthread  -DNDEBUG -DTRIMMED -g -O3

CodeGenerator-shared.ii --param ggc-min-expand=5 --param ggc-min-heapsize=512


[Bug lto/56570] ICE when streaming a TREE_BLOCK

2013-03-08 Thread jamborm at gcc dot gnu.org


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



Martin Jambor  changed:



   What|Removed |Added



 Target||x86_64-linux-gnu

   Host||x86_64-linux-gnu



--- Comment #1 from Martin Jambor  2013-03-08 
10:39:52 UTC ---

Let me copy over here from PR 45375 the backtrace:



#0  0x00f89a73 in get_location_from_adhoc_loc (set=0x77ff2000,

loc=2947526575) at /home/mjambor/gcc/trunk/src/libcpp/line-map.c:165

#1  0x00c247fe in inlined_function_outer_scope_p (block=0x7fffee4bcb28)

at /home/mjambor/gcc/trunk/src/gcc/tree.h:5561

#2  pack_ts_block_value_fields (expr=0x7fffee4bcb28, bp=0x7fffd1a0,

ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:319

#3  streamer_pack_tree_bitfields (ob=0x1c73210, bp=0x7fffd1a0,

expr=0x7fffee4bcb28)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:417

#4  0x009c3bc9 in lto_write_tree (ref_p=true, expr=0x7fffee4bcb28,

ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:317

#5  lto_output_tree (ob=0x1c73210, expr=0x7fffee4bcb28, ref_p=true,

this_ref_p=) at

/home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:410

#6  0x00c26617 in write_ts_common_tree_pointers (ref_p=true,

expr=0x73f6bc80, ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:514

#7  streamer_write_tree_body (ob=0x1c73210, expr=0x73f6bc80,

ref_p=)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:845

#8  0x009c3bf7 in lto_write_tree (ref_p=true, expr=0x73f6bc80,

ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:321

#9  lto_output_tree (ob=ob@entry=0x1c73210, expr=0x73f6bc80,

ref_p=ref_p@entry=true,

this_ref_p=this_ref_p@entry=true)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:410

#10 0x00c26e62 in write_ts_exp_tree_pointers (ref_p=,

expr=, ob=)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:747

#11 streamer_write_tree_body (ob=0x1c73210, expr=0x7fffecc63dc0,

ref_p=)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:884

#12 0x009c3bf7 in lto_write_tree (ref_p=true, expr=0x7fffecc63dc0,

ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:321

#13 lto_output_tree (ob=0x1c73210, expr=0x7fffecc63dc0, ref_p=true,

this_ref_p=) at

/home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:410

#14 0x00c26df8 in write_ts_exp_tree_pointers (ref_p=,

expr=, ob=)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:746

#15 streamer_write_tree_body (ob=0x1c73210, expr=0x7fffecc70078,

ref_p=)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:884

#16 0x009c3bf7 in lto_write_tree (ref_p=true, expr=0x7fffecc70078,

ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:321

#17 lto_output_tree (ob=ob@entry=0x1c73210, expr=0x7fffecc70078,

ref_p=ref_p@entry=true,

this_ref_p=this_ref_p@entry=true)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:410

#18 0x00c2681d in write_ts_decl_common_tree_pointers (ref_p=true,

expr=0x7fffecc6d720, ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:584

#19 streamer_write_tree_body (ob=0x1c73210, expr=0x7fffecc6d720,

ref_p=)

at /home/mjambor/gcc/trunk/src/gcc/tree-streamer-out.c:857

#20 0x009c3bf7 in lto_write_tree (ref_p=true, expr=0x7fffecc6d720,

ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:321

#21 lto_output_tree (ob=0x1c73210, expr=0x7fffecc6d720, ref_p=true,

this_ref_p=) at

/home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:410

#22 0x00ecd118 in output_gimple_stmt (stmt=0x7fffec6206c0,

ob=0x1c73210)

at /home/mjambor/gcc/trunk/src/gcc/gimple-streamer-out.c:143

#23 output_bb (ob=0x1c73210, bb=0x7fffed130f08, fn=0x7fffef8603f0)

at /home/mjambor/gcc/trunk/src/gcc/gimple-streamer-out.c:199

#24 0x009c4f26 in output_function (node=0x7fffef8614a0)

at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:823

#25 lto_output () at /home/mjambor/gcc/trunk/src/gcc/lto-streamer-out.c:987

#26 0x009fa971 in ipa_write_summaries_2 (

pass=0x1618f00 , state=0x1ad8c00)

at /home/mjambor/gcc/trunk/src/gcc/passes.c:2408





I am not sure to what extent it matters, given that the failure

apparently depends on when certain GC takes place, but the first

failing revision is 196174:



commit 560965e9b33deb5fa67c848c8b14ea7bbb42e8a2

Author: rguenth

Date:   Wed Feb 20 15:19:13 2013 +



2013-02-20  Richard Biener  



* tree-call-cdce.c (tree_call_cdce): Do not remove unused locals.

* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.

* tree-ssa-dce.c (perform_tree_ssa_dce): Like