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]

Bug report (and fix): 2.95.2 Wide char constant folding


This bug has been fixed in the 30-jan-2000 tree, I am reporting the bug and
including the fix for those (like me) who just want to fix the 2.95.2

test program:
#include <stdio.h>

int main (int argc, char** argv)
{
    printf  ("wide string: %S\n",  argc < 0 ? L"FAIL" : L"PASS");
    return 0;
}

it fails because of an invalid comparison of the 2 wide character constant
are the same.

Here is the fix:
*** fold-const.c.orig Tue Oct 19 10:40:05 1999
--- fold-const.c Tue Feb  1 15:28:04 2000
*************** operand_equal_p (arg0, arg1, only_const)
*** 2131,2137 ****

        case STRING_CST:
   return (TREE_STRING_LENGTH (arg0) == TREE_STRING_LENGTH (arg1)
!   && ! strncmp (TREE_STRING_POINTER (arg0),
           TREE_STRING_POINTER (arg1),
           TREE_STRING_LENGTH (arg0)));

--- 2131,2137 ----

        case STRING_CST:
   return (TREE_STRING_LENGTH (arg0) == TREE_STRING_LENGTH (arg1)
!   && ! memcmp (TREE_STRING_POINTER (arg0),
           TREE_STRING_POINTER (arg1),
           TREE_STRING_LENGTH (arg0)));






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