[Piglit] [PATCH] cl: fix 64bit-integer reading
Tom Stellard
tom at stellard.net
Fri Aug 16 06:39:42 PDT 2013
On Thu, Aug 15, 2013 at 10:12:43AM +0800, Homer Hsing wrote:
> "int-definitions.cl" uses a 64bit-integer 18446744073709551615.
>
> in "tests/cl/program/execute/compiler_long_mult.cl",
> [test]
> name: Long Definitions
> kernel_name: test_long
> arg_out: 0 buffer long[3] 9223372036854775807 \
> -9223372036854775808 \
> HERE-> 18446744073709551615
>
> That integer was read by "strtoll()".
>
> in "tests/cl/program/program-tester.c",
> int64_t
> get_int(const char* src)
> {
> if(regex_match(src, REGEX_FULL_MATCH(REGEX_INT))) {
> HERE-> return strtoll(src, NULL, 0);
>
> But,
> strtoll("18446744073709551615", NULL, 0) == 9223372036854775807
>
> This patch fixes the bug.
>
> Signed-off-by: Homer Hsing <homer.xing at intel.com>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> ---
> tests/cl/program/program-tester.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
> index d898691..a153f50 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -582,7 +582,9 @@ get_bool(const char* src)
> int64_t
> get_int(const char* src)
> {
> - if(regex_match(src, REGEX_FULL_MATCH(REGEX_INT))) {
> + if(regex_match(src, REGEX_FULL_MATCH(REGEX_UINT))) {
> + return strtoull(src, NULL, 0);
> + } else if(regex_match(src, REGEX_FULL_MATCH(REGEX_INT))) {
> return strtoll(src, NULL, 0);
> } else {
> fprintf(stderr,
> --
> 1.8.1.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list