Paul Eggert wrote:
> Shouldn't we simply fix GCC instead?

I agree. The appended simpler test case (with 'unsigned short' instead of
'unsigned int', to see the warning on a 32-bit platform as well) produces
the warning with "gcc -Wall", even without -W, with any of 3.3.1, 3.4.3,
4.0.0.

It appears that gcc emits that message each time it can optimize the 'if'
away. When a compiler gives a warning on each optimization that it performs,
we can only ignore such warnings.

Bruno


=============================== foo.c =======================================
#include <stddef.h>
extern void foo ();
# define xalloc_oversized(n, s) \
    ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
void bar (unsigned short n)
{
  if (xalloc_oversized ((size_t)n, sizeof (int)))
    foo ();
}
=============================================================================



_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to