Hi,

GCC currently doesn't bootstrap on s390x.  The problem is that
gengtype is miscompiled and I suspect the fre - sccvn changes to be
the culprit.

When sccvn performs the depth-first search for uses it might reach
global variable definitions. If the global variable is initialized
with a value that value is taken as constant and used to replace uses
of that variable.

e.g.:

int global = 1;

int
foo (int a)
{
  return a != global;
}

int
main ()
{
  global = 3;
  if (foo (3))
    abort ();
}

becomes (compiled with -O1):

foo (a)
{
  int global.0;
  int D.1626;

<bb 2>:
  global.0_1 = 1;
  D.1626_3 = a_2(D) != global.0_1;
  return D.1626_3;

}
...

The example works fine when removing the initialization of global.

Bye,

-Andreas-



Here is the complete fre output:

;; Function foo (foo)

SCC consists of: global_5(D) 
Value numbering global_5(D) stmt = (void) 0;
Setting value number of global_5(D) to global_5(D)
SCC consists of: a_2(D) 
Value numbering a_2(D) stmt = (void) 0;
Setting value number of a_2(D) to a_2(D)
SCC consists of: global.0_1 
Value numbering global.0_1 stmt = global.0_1 = global;
RHS global simplified to 1 has constants 0
Setting value number of global.0_1 to 1
SCC consists of: D.1626_3 
Value numbering D.1626_3 stmt = D.1626_3 = a_2(D) != global.0_1;
Setting value number of D.1626_3 to D.1626_3
Value numbers:
global.0_1 = 1
Created value VH.0 for a_2(D)
SCCVN says global.0_1 value numbers to 1
Created value VH.1 for D.1626_3
Created value VH.2 for <retval>_4
exp_gen[0] := {  }
tmp_gen[0] := {  }
avail_out[0] := { a_2(D) (VH.0)  }
exp_gen[2] := {  }
tmp_gen[2] := { <retval>_4 (VH.2)  }
avail_out[2] := { a_2(D) (VH.0) , D.1626_3 (VH.1) , <retval>_4 (VH.2)  }
exp_gen[1] := {  }
tmp_gen[1] := {  }
avail_out[1] := {  }
Replaced global with 1 in global.0_1 = global;
foo (a)
{
  int global.0;
  int D.1626;

<bb 2>:
  global.0_1 = 1;
  D.1626_3 = a_2(D) != global.0_1;
  return D.1626_3;

}



;; Function main (main)

SCC consists of: global_2(D) 
Value numbering global_2(D) stmt = (void) 0;
Setting value number of global_2(D) to global_2(D)
SCC consists of: global_3 
Value numbering global_3 stmt = global = 3;
No store match
Value numbering store global to 3
Setting value number of global_3 to global_3
SCC consists of: D.1630_1 
Value numbering D.1630_1 stmt = D.1630_1 = foo (3);
Setting value number of D.1630_1 to D.1630_1
Value numbers:
Created value VH.3 for D.1630_1
exp_gen[0] := {  }
tmp_gen[0] := {  }
avail_out[0] := {  }
exp_gen[2] := {  }
tmp_gen[2] := {  }
avail_out[2] := { D.1630_1 (VH.3)  }
exp_gen[3] := {  }
tmp_gen[3] := {  }
avail_out[3] := { D.1630_1 (VH.3)  }
exp_gen[4] := {  }
tmp_gen[4] := {  }
avail_out[4] := { D.1630_1 (VH.3)  }
exp_gen[1] := {  }
tmp_gen[1] := {  }
avail_out[1] := {  }
main ()
{
  int D.1630;

<bb 2>:
  global = 3;
  D.1630_1 = foo (3);
  if (D.1630_1 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  abort ();

<bb 4>:
  return;

}


Reply via email to