Fix compilation of check-qint.c by using a long long integer constant
PATCH v2 1/1 Fix compilation of check-qint.c by using a long long integer constant
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type
--- check-qint.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
check-qint.c +1 -1
@@ -43,7 +43,7 @@ END_TESTSTART_TEST (qint_from_int64_test) {QInt *qi; -const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ; qi =qint_from_int (value);fail_unless (qi->value == value);
Signature · 1 line
1.6.3.3
Quoted 11 lines · Pierre Riteau
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type--- check-qint.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)check-qint.c +0
-0
check-qint.c END_TEST · line 46
Quoted 5 lines
check-qint.c +1
-1@@ -43,7 +43,7 @@ END_TESTSTART_TEST (qint_from_int64_test) {QInt *qi; -const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ;
Hm, well it does not really fit in a signed long long either (so from that aspect it should be ULL).
Should it not be simply -1 (does qemu assume all architectures use two's complement?)?
Quoted 7 lines · Reimar D?ffinger
Quoted 6 lines · Pierre Riteau
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type--- check-qint.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines
check-qint.c END_TEST · line 46
Quoted 10 lines
check-qint.c +1
-1@@ -43,7 +43,7 @@ END_TESTSTART_TEST (qint_from_int64_test) {QInt *qi; -const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ;Hm, well it does not really fit in a signed long long either (so from that aspect it should be ULL).
Should it not be simply -1 (does qemu assume all architectures use two's complement?)?
Yes.
Signature · 1 line
mailto:[email protected]
Quoted 9 lines · malc
Quoted 7 lines
check-qint.c END_TEST · line 46
Quoted 2 lines
check-qint.c +1
-1-const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ;Hm, well it does not really fit in a signed long long either (so from that aspect it should be ULL).
Should it not be simply -1 (does qemu assume all architectures use two's complement?)?Yes.
Yes, but be aware that GCC nowadays does some optimisations which assume calculations do not wraparound when using signed types. See -fwrapv and -fno-strict-overflow. They tripped up the Linux kernel recently, causing some range tests to be optimised away. Those optimisations warrant caution when thinking in two's complement while using signed types.
For unsigned types, the ANSI C language uses arithmetic (mod 2^bits) for unsigned types. You can always write 0ULL-1, even theoretically on non-two's complement machines: that's well-defined in C to have all one bits set.
-- Jamie
Quoted 7 lines · Reimar Döffinger
Quoted 6 lines · Pierre Riteau
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type
---check-qint.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines
check-qint.c END_TEST · line 46
Quoted 10 lines
check-qint.c +1
-1@@ -43,7 +43,7 @@ END_TESTSTART_TEST (qint_from_int64_test) {QInt *qi; -const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ;Hm, well it does not really fit in a signed long long either (so from that aspect it should be ULL).
Should it not be simply -1 (does qemu assume all architectures use two's complement?)?
How about INT64_MIN?
Signature · 1 line
Pierre Riteau -- http://perso.univ-rennes1.fr/pierre.riteau/
Quoted 28 lines · On Fri, 4 Sep 2009 19:56:30 +0200 Pierre Riteau <[email protected]> wrote:
Quoted 7 lines · Reimar Döffinger
Quoted 6 lines · Pierre Riteau
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type
---check-qint.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)Quoted 16 lines
check-qint.c END_TEST · line 46
Quoted 10 lines
check-qint.c +1
-1@@ -43,7 +43,7 @@ END_TESTSTART_TEST (qint_from_int64_test) {QInt *qi; -const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ;Hm, well it does not really fit in a signed long long either (so from that
aspect it should be ULL).
Should it not be simply -1 (does qemu assume all architectures use two's complement?)?
Quoted 1 line
How about
INT64_MIN?
The test is there to assure that QInt can handle
integers > 32-bits, so it's not an issue if we have fewer bits.
Quoted 31 lines · Luiz Capitulino
Quoted 28 lines · On Fri, 4 Sep 2009 19:56:30 +0200 Pierre Riteau <[email protected]> wrote:
Quoted 23 lines · Reimar Döffinger
Quoted 11 lines · Pierre Riteau
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type
---check-qint.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)check-qint.c +0
-0check-qint.c END_TEST · line 46
Quoted 5 lines
check-qint.c +1
-1@@ -43,7 +43,7 @@ END_TESTSTART_TEST (qint_from_int64_test) {QInt *qi; -const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ;Hm, well it does not really fit in a signed long long either (so from that
aspect it should be ULL).
Should it not be simply -1 (does qemu assume all architectures use two's complement?)?
Quoted 5 lines
Quoted 1 line
How about
INT64_MIN?The test is there to assure that QInt can handle
integers > 32-bits, so it's not an issue if we have fewer bits.
For that this value is nonsense, this test could succeed even with a 32 bit QInt and sign expansion.
Not to mention that also a conversion to float and back would keep the value unchanged, although it would lose information in the general case. If it's supposed to test that it will really store 64 bit it should be some random number with variation in both upper and lower bits.
Quoted 38 lines · Reimar Döffinger
Quoted 31 lines · Luiz Capitulino
Quoted 28 lines · On Fri, 4 Sep 2009 19:56:30 +0200 Pierre Riteau <[email protected]> wrote:
Quoted 23 lines · Reimar Döffinger
Quoted 11 lines · Pierre Riteau
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type
---check-qint.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)check-qint.c +0
-0check-qint.c END_TEST · line 46
Quoted 5 lines
check-qint.c +1
-1@@ -43,7 +43,7 @@ END_TESTSTART_TEST (qint_from_int64_test) {QInt *qi; -const int64_t value =0xffffffffffffffff ; +const int64_t value =0xffffffffffffffffLL ;Hm, well it does not really fit in a signed long long either (so from that
aspect it should be ULL).
Should it not be simply -1 (does qemu assume all architectures use two's complement?)?Quoted 5 lines
Quoted 1 line
How about
INT64_MIN?The test is there to assure that QInt can handle integers > 32-bits, so it's not an issue if we have fewer bits.
Quoted 8 lines
For that this value is nonsense, this test could succeed even with a 32 bit QInt and sign expansion.
Not to mention that also a conversion to float and back would keep the value unchanged, although it would lose information in the general case. If it's supposed to test that it will really store 64 bit it should be some random number with variation in both upper and lower bits.
Very good point.
I sent a new patch to the list.
Signature · 1 line
Pierre Riteau -- http://perso.univ-rennes1.fr/pierre.riteau/
Quoted 2 lines · On Fri, 4 Sep 2009 19:09:58 +0200 Pierre Riteau <[email protected]> wrote:
Error was:
check-qint.c:46: error: integer constant is too large for 'long' type
You forgot the Signed-off-by line, otherwise:
I've built the series on i386, but forgot to enable the test-suite.