This is the mail archive of the gcc-patches@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]

patch to fold-const.c


Hi,

The following testcase fails while comparing the signed value with 
unsigned value. Here is the patch which fixes this problem. Okay to apply.
This is failing with gcc version 2.9-gnupro-99r1 under solaris platform 
and also for mips target.

void    main(void)
{
    int         is = -32768 ;
    unsigned int    iu = 0 ;
    unsigned int    ua ;

    ua = ( iu >= is ) ? iu : is ;

    if( ua == is ) 
        exit (0);
    abort ();
}

Here is the patch

	* fold-const.c (fold): Convert to proper type before reducing the
	depth of the tree.

Index: fold-const.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/fold-const.c,v
retrieving revision 1.148
diff -p -r1.148 fold-const.c
*** fold-const.c        2000/01/13 03:59:35     1.148
--- fold-const.c        2000/05/30 22:51:38
*************** fold (expr) 
*** 5809,5815 ****
          && (! FLOAT_TYPE_P (type)
              || (flag_fast_math && code == MULT_EXPR)))
        {
!         t = reduce_expression_tree_depth (code, type, arg0, arg1);
          code = TREE_CODE (t);
          arg0 = TREE_OPERAND (t, 0);
          arg1 = TREE_OPERAND (t, 1);
--- 5809,5817 ----
          && (! FLOAT_TYPE_P (type)
              || (flag_fast_math && code == MULT_EXPR)))
        {
!         t = reduce_expression_tree_depth (code, type,
!                                           convert (type, arg0),
!                                           convert (type, arg1));
          code = TREE_CODE (t);
          arg0 = TREE_OPERAND (t, 0);
          arg1 = TREE_OPERAND (t, 1);






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