Hi all (and wide-int maintainers in particular),

I tried bootstrapping the wide-int branch on arm-none-linux-gnueabihf and 
encountered some syntax errors while building wide-int.h and wide-int.cc in 
expressions that tried to cast to HOST_WIDE_INT. This patch fixes those errors. 
Also, in c-ada-spec.c I think we intended to use the HOST_WIDE_INT_PRINT format 
rather than HOST_LONG_FORMAT, since on arm-linux HOST_WIDE_INT is a 'long long'.

The attached patch allowed the build to proceed for me, but in stage 2 I 
encountered an ICE:

$TOP/gcc/dwarf2out.c: In function 'long unsigned int 
_ZL11size_of_dieP10die_struct.isra.209(vec<dw_attr_struct, va_gc>**, long 
unsigned int)':
$TOP/gcc/dwarf2out.c:7820:1: internal compiler error: in set_value_range, at 
tree-vrp.c:452
 size_of_die (dw_die_ref die)
 ^
0xa825c1 set_value_range
        $TOP/gcc/tree-vrp.c:452
0xa8a441 extract_range_basic
        $TOP/gcc/tree-vrp.c:3679
0xa92c13 vrp_visit_assignment_or_call
        $TOP/gcc/tree-vrp.c:6725
0xa947eb vrp_visit_stmt
        $TOP/gcc/tree-vrp.c:7538
0x9d4d47 simulate_stmt
        $TOP/gcc/tree-ssa-propagate.c:329
0x9d5047 simulate_block
        $TOP/gcc/tree-ssa-propagate.c:452
0x9d5e23 ssa_propagate(ssa_prop_result (*)(gimple_statement_base*, edge_def**, 
tree_node**), ssa_prop_result (*)(gimple_statement_base*))
        $TOP/gcc/tree-ssa-propagate.c:859
0xa9a1e1 execute_vrp
        $TOP/gcc/tree-vrp.c:9781
0xa9a4a3 execute
        $TOP/gcc/tree-vrp.c:9872
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


Any ideas? The compiler was configured with: --enable-languages=c,c++,fortran 
--with-cpu=cortex-a15 --with-float=hard --with-mode=thumb

Thanks,
Kyrill


gcc/
2014-04-15  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

        * wide-int.h (sign_mask): Fix syntax error.
        * wide-int.cc (wi::add_large): Likewise.
        (mul_internal): Likewise.
        (sub_large): Likewise.
        
c-family/
2014-04-15  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

        * c-ada-spec.c (dump_generic_ada_node): Use HOST_WIDE_INT_PRINT
        instead of HOST_LONG_FORMAT.
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 35b036c..0a28840 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -2205,7 +2205,7 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
 	      val = -val;
 	    }
 	  sprintf (pp_buffer (buffer)->digit_buffer,
-		   "16#%" HOST_LONG_FORMAT "x", val.elt (val.get_len () - 1));
+		   "16#%" HOST_WIDE_INT_PRINT "x", val.elt (val.get_len () - 1));
 	  for (i = val.get_len () - 2; i <= 0; i--)
 	    sprintf (pp_buffer (buffer)->digit_buffer,
 		     HOST_WIDE_INT_PRINT_PADDED_HEX, val.elt (i));
diff --git a/gcc/wide-int.cc b/gcc/wide-int.cc
index fbef721..a64ed88 100644
--- a/gcc/wide-int.cc
+++ b/gcc/wide-int.cc
@@ -1130,7 +1130,7 @@ wi::add_large (HOST_WIDE_INT *val, const HOST_WIDE_INT *op0,
       if (sgn == SIGNED)
 	{
 	  unsigned HOST_WIDE_INT x = (val[len - 1] ^ o0) & (val[len - 1] ^ o1);
-	  *overflow = HOST_WIDE_INT (x << shift) < 0;
+	  *overflow = (HOST_WIDE_INT) (x << shift) < 0;
 	}
       else
 	{
@@ -1369,7 +1369,7 @@ wi::mul_internal (HOST_WIDE_INT *val, const HOST_WIDE_INT *op1val,
 	{
 	  if (sgn == SIGNED)
 	    {
-	      if (HOST_WIDE_INT (r) != sext_hwi (r, prec))
+	      if ((HOST_WIDE_INT) (r) != sext_hwi (r, prec))
 		*overflow = true;
 	    }
 	  else
@@ -1549,7 +1549,7 @@ wi::sub_large (HOST_WIDE_INT *val, const HOST_WIDE_INT *op0,
       if (sgn == SIGNED)
 	{
 	  unsigned HOST_WIDE_INT x = (o0 ^ o1) & (val[len - 1] ^ o0);
-	  *overflow = HOST_WIDE_INT (x << shift) < 0;
+	  *overflow = (HOST_WIDE_INT) (x << shift) < 0;
 	}
       else
 	{
diff --git a/gcc/wide-int.h b/gcc/wide-int.h
index a0241f2..2163f3c 100644
--- a/gcc/wide-int.h
+++ b/gcc/wide-int.h
@@ -801,7 +801,7 @@ generic_wide_int <storage>::sign_mask () const
       if (excess > 0)
 	high <<= excess;
     }
-  return HOST_WIDE_INT (high) < 0 ? -1 : 0;
+  return (HOST_WIDE_INT) (high) < 0 ? -1 : 0;
 }
 
 /* Return the signed value of the least-significant explicitly-encoded

Reply via email to