This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/21959] [4.1 Regression] Ada depends on signed overflow


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-06-17 19:56 -------
Well, it seems to me that the culprit is fold, no?

	    else if (!in_gimple_form
		     && TREE_INT_CST_HIGH (arg1) == signed_max_hi
		     && TREE_INT_CST_LOW (arg1) == signed_max_lo
		     && TYPE_UNSIGNED (TREE_TYPE (arg1))
		     /* signed_type does not work on pointer types.  */
		     && INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
	      {
		/* The following case also applies to X < signed_max+1
		   and X >= signed_max+1 because previous transformations.  */
		if (code == LE_EXPR || code == GT_EXPR)
		  {
		    tree st0, st1;
		    st0 = lang_hooks.types.signed_type (TREE_TYPE (arg0));
		    st1 = lang_hooks.types.signed_type (TREE_TYPE (arg1));
		    return fold
		      (build2 (code == LE_EXPR ? GE_EXPR: LT_EXPR,
			       type, fold_convert (st0, arg0),
			       fold_convert (st1, integer_zero_node)));
		  }
	      }

(gdb) p debug_tree(arg0)
 <var_decl 0x556e1d80 J4b
    type <integer_type 0x556d9144 character sizes-gimplified public visited
unsigned QI
        size <integer_cst 0x556a61f8 constant invariant visited 8>
        unit size <integer_cst 0x556a6210 constant invariant visited 1>
        user align 8 symtab 0 alias set -1 precision 8 min <integer_cst
0x556d71e0 0> max <integer_cst 0x556d71f8 255> RM size <integer_cst 0x556a61f8 8>
        pointer_to_this <pointer_type 0x556d93cc access_character>>
    unsigned ignored QI file ../../asets.adb line 3 size <integer_cst 0x556a61f8
8> unit size <integer_cst 0x556a6210 1>
    align 8 context <function_decl 0x556e0144 asets___elabb> initial
<integer_cst 0x556d71e0 0>>
$13 = void
(gdb) p debug_tree(arg1)
 <integer_cst 0x556e3030 type <integer_type 0x556d9144 character> constant
invariant 127>
$14 = void
(gdb) p code
$15 = LE_EXPR


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]