Bug 20542 - [4.1 Regression] Bootstrap failure at -Os
Summary: [4.1 Regression] Bootstrap failure at -Os
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 critical
Target Milestone: 4.1.0
Assignee: Daniel Berlin
URL:
Keywords: build, patch, wrong-code
: 20543 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-03-18 21:21 UTC by Richard Earnshaw
Modified: 2005-03-21 19:28 UTC (History)
3 users (show)

See Also:
Host: i386-unknown-netbsdelf arm-unknown-netbsdelf
Target: i386-unknown-netbsdelf arm-unknown-netbsdelf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-03-18 21:45:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Earnshaw 2005-03-18 21:21:35 UTC
Bootstrapping with BOOT_CFLAGS="-Os -g" fails when the stage2 cc1 is used to
build  crtstuff.o.  The segmentation fault occurs in find_uses_to_rename_use but
the error really seems to be in its caller find_uses_to_rename_bb
(tree-ssa-loop-manip.c).  Looking at the tree dumps we have in t49.loopinit

<L8>:;
  stmt_35 = bsi_stmt (bsi);
  get_stmt_operands (stmt_35);
  var_38 = op_iter_init_tree (&iter, stmt_35, 13);
  goto <bb 9> (<L10>);

<L9>:;
  var_45 = op_iter_next_tree (&iter);

<L10>:;
  D.17355_41 = iter.done;
  D.17353_42 = (int) D.17355_41;
  D.17347_44 = (unsigned char) D.17353_42;
  if (D.17347_44 == 0) goto <L9>; else goto <L12>;

but in t50.lim we have:

<L8>:;
  stmt_35 = bsi_stmt (bsi);
  get_stmt_operands (stmt_35);
  var_38 = op_iter_init_tree (&iter, stmt_35, 13);
  lsm_tmp.500_356 = iter.done;
  goto <bb 9> (<L10>);

<L9>:;
  var_45 = op_iter_next_tree (&iter);

<L10>:;
  D.17355_41 = lsm_tmp.500_356;
  D.17353_42 = (int) D.17355_41;
  D.17347_44 = (unsigned char) D.17353_42;
  if (D.17347_44 == 0) goto <L9>; else goto <L18>;

<L18>:;
  iter.done = lsm_tmp.500_356;

note that the use of iter.done has been hoisted out of the loop even though the
call of op_iter_next_tree passes the address of iter.
Comment 1 Richard Earnshaw 2005-03-18 21:24:05 UTC
*** Bug 20543 has been marked as a duplicate of this bug. ***
Comment 2 Daniel Berlin 2005-03-18 21:33:56 UTC
Subject: Re:  New: [4.1 Regression] Bootstrap
	failure at -Os

On Fri, 2005-03-18 at 21:21 +0000, rearnsha at gcc dot gnu dot org
wrote:
> Bootstrapping with BOOT_CFLAGS="-Os -g" fails when the stage2 cc1 is used to
> build  crtstuff.o.  The segmentation fault occurs in find_uses_to_rename_use but
> the error really seems to be in its caller find_uses_to_rename_bb
> (tree-ssa-loop-manip.c).  Looking at the tree dumps we have in t49.loopinit
> 
> <L8>:;
>   stmt_35 = bsi_stmt (bsi);
>   get_stmt_operands (stmt_35);
>   var_38 = op_iter_init_tree (&iter, stmt_35, 13);
>   goto <bb 9> (<L10>);
> 
> <L9>:;
>   var_45 = op_iter_next_tree (&iter);
> 
> <L10>:;
>   D.17355_41 = iter.done;
>   D.17353_42 = (int) D.17355_41;
>   D.17347_44 = (unsigned char) D.17353_42;
>   if (D.17347_44 == 0) goto <L9>; else goto <L12>;
> 
> but in t50.lim we have:
> 
> <L8>:;
>   stmt_35 = bsi_stmt (bsi);
>   get_stmt_operands (stmt_35);
>   var_38 = op_iter_init_tree (&iter, stmt_35, 13);
>   lsm_tmp.500_356 = iter.done;
>   goto <bb 9> (<L10>);
> 
> <L9>:;
>   var_45 = op_iter_next_tree (&iter);
> 
> <L10>:;
>   D.17355_41 = lsm_tmp.500_356;
>   D.17353_42 = (int) D.17355_41;
>   D.17347_44 = (unsigned char) D.17353_42;
>   if (D.17347_44 == 0) goto <L9>; else goto <L18>;
> 
> <L18>:;
>   iter.done = lsm_tmp.500_356;
> 
> note that the use of iter.done has been hoisted out of the loop even though the
> call of op_iter_next_tree passes the address of iter.

This is probably because is_call_clobbered_ref is wrong for variables
that have subvars (it checks the base var instead of the SFT's).


Comment 3 Daniel Berlin 2005-03-18 21:45:00 UTC
I'm testing a patch now
Comment 4 Andrew Pinski 2005-03-20 16:50:44 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01830.html>.
Comment 5 GCC Commits 2005-03-21 19:27:12 UTC
Subject: Bug 20542

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dberlin@gcc.gnu.org	2005-03-21 19:27:02

Modified files:
	gcc            : ChangeLog tree-flow-inline.h tree-flow.h 
	                 tree-ssa-alias.c tree-ssa-loop-im.c 
	                 tree-ssa-operands.c 

Log message:
	2005-03-18  Daniel Berlin  <dberlin@dberlin.org>
	
	Fix PR tree-optimization/20542
	
	* tree-flow-inline.h (overlap_subvar): Move to here.
	* tree-ssa-operands.c: From here.
	* tree-flow.h (overlap_subvar): Declare.
	* tree-ssa-alias.c (add_pointed_to_var): Use overlap_subvar here.
	* tree-ssa-loop-im.c (is_call_clobbered_ref): Return proper answer
	for variables with subvars.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7946&r2=2.7947
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-flow-inline.h.diff?cvsroot=gcc&r1=2.33&r2=2.34
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-flow.h.diff?cvsroot=gcc&r1=2.86&r2=2.87
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-alias.c.diff?cvsroot=gcc&r1=2.75&r2=2.76
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-loop-im.c.diff?cvsroot=gcc&r1=2.31&r2=2.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-operands.c.diff?cvsroot=gcc&r1=2.68&r2=2.69

Comment 6 Daniel Berlin 2005-03-21 19:28:11 UTC
Fixed