https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98771

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #3)
> Please note that the failure only occurs for i386-pc-solaris2.11 and
> sparc-sun-solaris2.11 compilers with -m64.

Martin, you can easily simulate that by changing
host_size_t_cst_p:
       && (wi::min_precision (wi::to_wide (t), UNSIGNED)
-          <= sizeof (size_t) * CHAR_BIT))
+          <= sizeof (unsigned) * CHAR_BIT))

That will make your 64-bit gcc behave like Rainer's 32-bit gcc targeting -m64.
I'd say we want to kill that function or adjust it all.
Perhaps change it into writing unsigned HOST_WIDE_INT value instead of size_t,
and then in the callers if that s2 is > SIZE_MAX see whether we care or not.
E.g. on:
      if (!host_size_t_cst_p (arg2, &s2))
        return NULL_TREE;
      if (s2 == 0
          && !TREE_SIDE_EFFECTS (arg0)
          && !TREE_SIDE_EFFECTS (arg1))
        return build_int_cst (type, 0);
      else if ((p0 = c_getstr (arg0)) && (p1 = c_getstr (arg1)))
        return build_int_cst (type, strncmp (p0, p1, s2));
when the adjusted (and probably renamed) function writes unsigned HOST_WIDE_INT
s2 if it satisfies tree_fits_uhwi_p, the s2 == 0 test should remain, but
I think the other use should be either strncmp (p0, p1, MIN (s2, SIZE_MAX));
or s2 > SIZE_MAX ? strcmp (p0, p1) : strncmp (p0, p1, s2);, for warnings
perhaps the former is better.

The
CFN_BUILT_IN_BCMP/CFN_BUILT_IN_MEMCMP case is fine as is, because it compares
s2 <= s0 && s2 <= s1 and memchr too.

Reply via email to