Bug 34355 - ICE: invariant not recomputed when ADDR_EXPR changed with -ftree-parallelize-loops
Summary: ICE: invariant not recomputed when ADDR_EXPR changed with -ftree-parallelize-...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Zdenek Dvorak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-06 09:04 UTC by Uroš Bizjak
Modified: 2008-01-09 07:57 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2007-12-18 18:51:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uroš Bizjak 2007-12-06 09:04:15 UTC
This testcase fails with g++

--cut here--
typedef double EXPRESS[5];

extern int Terms;

void Parse_Rel_Factor (EXPRESS Express, int *Terms)
{
  EXPRESS Local_Express = {5.0, 4.0, 3.0, 2.0, 1.0};
  int Local_Terms = 5;

  int i;

  for (i = (*Terms); i < Local_Terms; i++)
    Express[i] = 0.0;

  Express[i] += Local_Express[i];
}

double Parse_Float ()
{
  EXPRESS Express = {1.0, 2.0, 3.0, 4.0, 5.0};

  Parse_Rel_Factor (Express, &Terms);
}
--cut here--

g++ -O3 -msse2 -ftree-parallelize-loops=4 tt.cpp
tt.cpp: In function âdouble Parse_Float()â:
tt.cpp:18: error: invariant not recomputed when ADDR_EXPR changed
&(*Express.105_26)[0];

tt.cpp:18: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Please note, that the same testcase, renamed to __.c compiles OK with 'gcc -O3 -msse2 -ftree-parallelize-loops=4 -S tt.c'. [I guess that due to this, 'c++' component should be selected.]

Also note, that if 'Express[i] += Local_Express[i];' line is removed, g++ segfaults trying to output diagnostics in:

Program received signal SIGSEGV, Segmentation fault.
0x081165d8 in cp_diagnostic_starter (context=0x8a5e040, diagnostic=0xbf8874b0) at ../../gcc-svn/trunk/gcc/cp/error.c:2466
/home/uros/gcc-svn/trunk/gcc/cp/error.c:2466:64935:beg:0x81165d8
(gdb) bt
#0  0x081165d8 in cp_diagnostic_starter (context=0x8a5e040, diagnostic=0xbf8874b0) at ../../gcc-svn/trunk/gcc/cp/error.c:2466
#1  0x082b9249 in diagnostic_report_diagnostic (context=0x8a5e040, diagnostic=0xbf8874b0) at ../../gcc-svn/trunk/gcc/diagnostic.c:421
#2  0x082b952a in error (gmsgid=0x893c52c "invariant not recomputed when ADDR_EXPR changed") at ../../gcc-svn/trunk/gcc/diagnostic.c:558
#3  0x084b3a51 in verify_expr (tp=0xb7c1c724, walk_subtrees=0xbf887568, data=0x0) at ../../gcc-svn/trunk/gcc/tree-cfg.c:3191
#4  0x0867544b in walk_tree_1 (tp=0xb7c1c724, func=0x84b2d50 <verify_expr>, data=0x0, pset=0x0, lh=0) at ../../gcc-svn/trunk/gcc/tree.c:8376
#5  0x0867557a in walk_tree_1 (tp=0xb7ccfdfc, func=0x84b2d50 <verify_expr>, data=0x0, pset=0x0, lh=0) at ../../gcc-svn/trunk/gcc/tree.c:8615
#6  0x0849ff1c in verify_stmts () at ../../gcc-svn/trunk/gcc/tree-cfg.c:4140
#7  0x085fb00f in verify_ssa (check_modified_stmt=1 '\001') at ../../gcc-svn/trunk/gcc/tree-ssa.c:613
#8  0x08411b25 in execute_function_todo (data=0x80000) at ../../gcc-svn/trunk/gcc/passes.c:963
#9  0x08411779 in do_per_function (callback=0x8411900 <execute_function_todo>, data=0x80000) at ../../gcc-svn/trunk/gcc/passes.c:805
#10 0x08411851 in execute_todo (flags=524288) at ../../gcc-svn/trunk/gcc/passes.c:989
#11 0x08411cda in execute_one_pass (pass=0x8a4f860) at ../../gcc-svn/trunk/gcc/passes.c:1081
Comment 1 Richard Biener 2007-12-06 10:37:11 UTC
Confirmed.

eliminate_local_variables_1 changes &Express[0] to &(*Express.96_73)[0]
without re-computing invariantness.

With the structure of eliminate_local_variables_stmt (it seems to operate
on non-gimple), it looks like it would require a second walk over the stmt
to recompute invariantness (or to make sure to do this at gimplification time).
Or to walk depth-first.

I'll leave that to Zdenek to figure out.
Comment 2 Zdenek Dvorak 2007-12-19 15:01:33 UTC
Subject: Bug 34355

Author: rakdver
Date: Wed Dec 19 15:01:19 2007
New Revision: 131063

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131063
Log:
	PR tree-optimization/34355
	* tree-parloops.c (take_address_of): Handle expresions
	instead of just variables.
	(eliminate_local_variables_1): Force whole invariant
	address to ssa name.

	* g++.dg/tree-ssa/pr34355.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr34355.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-parloops.c

Comment 3 Uroš Bizjak 2008-01-09 07:57:27 UTC
Fixed.