Hi,

Can a gatekeeper please review the appended patch that fixes the issue 
described below?

Here are testcases that produce failing result when compiled with opencc.
------------------------------
#include <stdio.h>
char myfunc(char i)
{
        return i*2;
}

int main()
{
          int i=0x40;
          printf("size of char %d\n", sizeof(char));
          if(myfunc(i) != (char)(i*2.0))
           printf("Failed\n");
          else
           printf("Passed\n");
        return 0;
}

------------------------------

#include <stdio.h>
int main()
{
          int i=0x40;
          if((char)0x80 != (char)(i*2.0))
           printf("Failed\n");
          else
           printf("Passed\n");
        return 0;
}

------------------------------
The following test from the GCC 4.2 regression suite:
.../testsuite/gcc.dg/sync-2.c


Problem/Fix Description:

  The problem is that the types of the sub-expressions (operands) of a gspin
  GS_NE_EXPR operator are not converted correctly during the translation to
  a WHIRL I4I4NE expression.  The types of the GS_NE_EXPR operands are both
  "char" and the translation produces WHIRL sub-expressions of type "int".
  The fix is to check the types of the gspin comparison node's sub-expressions
  and add conversions as necessary.

Thanks
Pallavi

Attachment: wgen.p
Description: wgen.p

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to