Commit 670c08b3 by David Malcolm Committed by David Malcolm

Fix int vs bool issue in jit.dg/test-arith-overflow.c

gcc/testsuite/ChangeLog:
	* jit.dg/test-arith-overflow.c: Include stdbool.h.
	(create_overflow_fn): Update comment to clarify that
	the third param of the created function is a bool *, not
	an int *.
	(verify_int_overflow_fn): Convert param "expected_ovf" from
	int to bool.  Update third param of "overflow_fn_type" from int *
	to bool *.  Update local "actual_ovf" from int to bool.
	(verify_uint_overflow_fn): Likewise.

From-SVN: r219856
parent 29c38396
2015-01-19 David Malcolm <dmalcolm@redhat.com>
* jit.dg/test-arith-overflow.c: Include stdbool.h.
(create_overflow_fn): Update comment to clarify that
the third param of the created function is a bool *, not
an int *.
(verify_int_overflow_fn): Convert param "expected_ovf" from
int to bool. Update third param of "overflow_fn_type" from int *
to bool *. Update local "actual_ovf" from int to bool.
(verify_uint_overflow_fn): Likewise.
2015-01-19 Martin Liska <mliska@suse.cz> 2015-01-19 Martin Liska <mliska@suse.cz>
* gcc.dg/ipa/ipa-icf-33.c: New test. * gcc.dg/ipa/ipa-icf-33.c: New test.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <stdbool.h>
#include "libgccjit.h" #include "libgccjit.h"
...@@ -16,7 +17,7 @@ create_overflow_fn (gcc_jit_context *ctxt, ...@@ -16,7 +17,7 @@ create_overflow_fn (gcc_jit_context *ctxt,
/* Create the equivalent of this C: /* Create the equivalent of this C:
int int
test_overflow_T_OP (T x, T y, int *ovf) test_overflow_T_OP (T x, T y, bool *ovf)
{ {
T result; T result;
result = x OP y; result = x OP y;
...@@ -129,16 +130,16 @@ verify_int_overflow_fn (gcc_jit_result *jit_result, ...@@ -129,16 +130,16 @@ verify_int_overflow_fn (gcc_jit_result *jit_result,
const char *funcname, const char *funcname,
int x, int y, int x, int y,
int expected_result, int expected_result,
int expected_ovf) bool expected_ovf)
{ {
CHECK_NON_NULL (jit_result); CHECK_NON_NULL (jit_result);
typedef int (*overflow_fn_type) (int, int, int *); typedef int (*overflow_fn_type) (int, int, bool *);
overflow_fn_type fn = overflow_fn_type fn =
(overflow_fn_type)gcc_jit_result_get_code (jit_result, funcname); (overflow_fn_type)gcc_jit_result_get_code (jit_result, funcname);
CHECK_NON_NULL (fn); CHECK_NON_NULL (fn);
/* Call the function: */ /* Call the function: */
int actual_ovf = 0; bool actual_ovf = 0;
int actual_result = fn (x, y, &actual_ovf); int actual_result = fn (x, y, &actual_ovf);
note ("%s (%d, %d) returned: %d with ovf: %d", note ("%s (%d, %d) returned: %d with ovf: %d",
funcname, x, y, actual_result, actual_ovf); funcname, x, y, actual_result, actual_ovf);
...@@ -151,16 +152,17 @@ verify_uint_overflow_fn (gcc_jit_result *jit_result, ...@@ -151,16 +152,17 @@ verify_uint_overflow_fn (gcc_jit_result *jit_result,
const char *funcname, const char *funcname,
unsigned int x, unsigned int y, unsigned int x, unsigned int y,
unsigned int expected_result, unsigned int expected_result,
int expected_ovf) bool expected_ovf)
{ {
CHECK_NON_NULL (jit_result); CHECK_NON_NULL (jit_result);
typedef unsigned int (*overflow_fn_type) (unsigned int, unsigned int, int *); typedef unsigned int (*overflow_fn_type) (unsigned int, unsigned int,
bool *);
overflow_fn_type fn = overflow_fn_type fn =
(overflow_fn_type)gcc_jit_result_get_code (jit_result, funcname); (overflow_fn_type)gcc_jit_result_get_code (jit_result, funcname);
CHECK_NON_NULL (fn); CHECK_NON_NULL (fn);
/* Call the function: */ /* Call the function: */
int actual_ovf = 0; bool actual_ovf = 0;
unsigned int actual_result = fn (x, y, &actual_ovf); unsigned int actual_result = fn (x, y, &actual_ovf);
note ("%s (%d, %d) returned: %d with ovf: %d", note ("%s (%d, %d) returned: %d with ovf: %d",
funcname, x, y, actual_result, actual_ovf); funcname, x, y, actual_result, actual_ovf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment