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]
Other format: [Raw text]

[Bug tree-optimization/34176] New: [4.3 Regression] SCCVN breaks gettext


The following testcase reduced from gettext does not terminate with FRE
enabled, as that replaces nitems + len2 with len2.


typedef __SIZE_TYPE__ size_t;
typedef unsigned int index_ty;
typedef index_ty *index_list_ty;

struct mult_index
{
  index_ty index;
  unsigned int count;
};

struct mult_index_list
{
  struct mult_index *item;
  size_t nitems;
  size_t nitems_max;

  struct mult_index *item2;
  size_t nitems2_max;
};

int __attribute__((noinline))
hash_find_entry (index_list_ty *result)
{
    static index_ty x = 2;
    *result = &x;
    return 0;
}

struct mult_index * __attribute__((noinline))
foo (size_t n)
{
  return 0;
}

int
main (void)
{
    size_t nitems = 0;

    for (;;)
    {
        index_list_ty list;

        if (hash_find_entry (&list) == 0)
        {
            size_t len2 = *list;
            struct mult_index *destptr;
            struct mult_index *dest;
            size_t new_max  = nitems + len2;

            if (new_max != len2)
                break;
            dest = foo (new_max);

            destptr = dest;
            while (len2--)
                destptr++;

            nitems = destptr - dest;
        }
    }

    return 0;
}


-- 
           Summary: [4.3 Regression] SCCVN breaks gettext
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: blocker
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34176


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