[Bug middle-end/12072] New: set constants generate wrong code

hebisch at math dot uni dot wroc dot pl gcc-bugzilla@gcc.gnu.org
Tue Aug 26 22:51:00 GMT 2003


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
        {



More information about the Gcc-bugs mailing list