This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bug report (and fix): 2.95.2 Wide char constant folding
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: Bug report (and fix): 2.95.2 Wide char constant folding
- From: "Jose Luu" <jluu at mainsoft dot com>
- Date: Wed, 2 Feb 2000 15:49:51 +0100
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)));