This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/12072] New: set constants generate wrong code
- From: "hebisch at math dot uni dot wroc dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2003 22:51:09 -0000
- Subject: [Bug middle-end/12072] New: set constants generate wrong code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12072
Summary: set constants generate wrong code
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hebisch at math dot uni dot wroc dot pl
CC: gcc-bugs at gcc dot gnu dot org
Backend tries to emit identical constants only once, however the
test for equality in reversed (negated), so two constants are
unified when hashes are equal and constants are not equal. The
problem affects GNU Pascal (IMHO "standard" frontends do not use
sets so problem can not be reproduced with them). The following
patch fixes the problem:
--- gcc.orig/varasm.c Sat Aug 16 19:06:03 2003
+++ gcc/varasm.c Sat Aug 16 19:04:13 2003
@@ -2411,7 +2411,7 @@
if (get_set_constructor_bytes (t2, tmp2, len) != NULL_TREE)
return 0;
- return memcmp (tmp1, tmp2, len) != 0;
+ return memcmp (tmp1, tmp2, len) == 0;
}
else
{