[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed new module intprops-test
From: |
Paul Eggert |
Subject: |
Re: proposed new module intprops-test |
Date: |
Fri, 20 May 2011 11:37:19 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 |
> With just the first 2 out of 3 commits (partial revert and work around IRIX
> 6.5
> cc bug), IRIX 6.5 cc would still have complained ("The indicated constant
> value
> is not known.") about a combination of signed and unsigned integers, this time
> with '|', not '+' ... and HP-UX cc would still complain
Thanks for checking that. These complaints are still worrisome,
because INT_ADD_OVERFLOW etc. can't be used as integer constant
expressions on those platforms. But the diagnostics you're sending
suggest that a new intprops.h implementation, which I've just pushed,
might fix things for those two platforms. Could you please give the
latest gnulib a try, with the following quick change?
--- a/tests/test-intprops.c
+++ b/tests/test-intprops.c
@@ -31,7 +31,7 @@
These tests should be checkable via 'verify' rather than 'ASSERT', but
using 'verify' would run into a bug with HP-UX 11.23 cc; see
<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. */
-#if __GNUC__ || __SUNPRO_C
+#if __GNUC__ || __SUNPRO_C || 1
# define VERIFY(x) do { verify (x); } while (0)
#else
# define VERIFY(x) ASSERT (x)
Or, if the above doesn't work, could you also try it after replacing
lib/intprop.h's two instances of
(b) - (b) + (a)
with
(b) - (b) + (a) - (a)
or with
(b) - (b) + ((a) - (a))
? Thanks again.
Here's the intprops.h patch I just pushed:
intprops: remove assumption about A|B representation
* lib/intprops.h (_GL_BINARY_OP_OVERFLOW): Do not assume that A|B
is a valid integer if both A and B are. Although this is true for
all known practical hosts, the C standard doesn't guarantee it,
and the code need not assume it. Also, this change may work around
HP-UX 11.23 and IRIX 6.5 cc bugs reported by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00426.html>.
diff --git a/lib/intprops.h b/lib/intprops.h
index bd9f040..293204a 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -311,13 +311,10 @@
/* Return 1 if the expression A <op> B would overflow,
where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
assuming MIN and MAX are the minimum and maximum for the result type.
-
- This macro assumes that A | B is a valid integer if both A and B are,
- which is true of all known practical hosts. If this is a problem
- for you, please let us know how to fix it for your host. */
+ Arguments should be free of side effects. */
#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \
op_result_overflow (a, b, \
- _GL_INT_MINIMUM ((a) | (b)), \
- _GL_INT_MAXIMUM ((a) | (b)))
+ _GL_INT_MINIMUM ((b) - (b) + (a)), \
+ _GL_INT_MAXIMUM ((b) - (b) + (a)))
#endif /* _GL_INTPROPS_H */
- proposed new module intprops-test, Paul Eggert, 2011/05/10
- Re: proposed new module intprops-test, Eric Blake, 2011/05/10
- Re: proposed new module intprops-test, Paul Eggert, 2011/05/10
- Re: proposed new module intprops-test, Bruno Haible, 2011/05/18
- Re: proposed new module intprops-test, Paul Eggert, 2011/05/19
- Re: proposed new module intprops-test, Bruno Haible, 2011/05/19
- Re: proposed new module intprops-test, Paul Eggert, 2011/05/19
- Re: proposed new module intprops-test, Bruno Haible, 2011/05/20
- Re: proposed new module intprops-test,
Paul Eggert <=