Преглед изворни кода

gcc: Fix OpenCL type checking for `short int'.

* gcc-plugin/src/starpu.c (validate_opencl_argument_type)[type map]:
  Change "short" to "short int".

* gcc-plugin/tests/pointers.c (my_pointer_task, my_mixed_task): Use
  `short' instead of `long', since `long' differs from `cl_long' on
  32-bit platforms.
Ludovic Courtès пре 13 година
родитељ
комит
0b6a3ffb1c
2 измењених фајлова са 12 додато и 12 уклоњено
  1. 1 1
      gcc-plugin/src/starpu.c
  2. 11 11
      gcc-plugin/tests/pointers.c

+ 1 - 1
gcc-plugin/src/starpu.c

@@ -1016,7 +1016,7 @@ validate_opencl_argument_type (location_t loc, const_tree type)
 	    {
 	      { "char", "cl_char" },
 	      { "unsigned char", "cl_uchar" },
-	      { "short", "cl_short" },
+	      { "short int", "cl_short" },
 	      { "unsigned short", "cl_ushort" },
 	      { "int", "cl_int" },
 	      { "unsigned int", "cl_uint" },

+ 11 - 11
gcc-plugin/tests/pointers.c

@@ -21,42 +21,42 @@
 
 /* The tasks under test.  */
 
-static void my_pointer_task (const int *x, long *y) __attribute__ ((task));
+static void my_pointer_task (const int *x, short *y) __attribute__ ((task));
 
-static void my_pointer_task_cpu (const int *, long *)
+static void my_pointer_task_cpu (const int *, short *)
   __attribute__ ((task_implementation ("cpu", my_pointer_task)));
-static void my_pointer_task_opencl (const int *, long *)
+static void my_pointer_task_opencl (const int *, short *)
   __attribute__ ((task_implementation ("opencl", my_pointer_task)));
 
 static void
-my_pointer_task_cpu (const int *x, long *y)
+my_pointer_task_cpu (const int *x, short *y)
 {
   printf ("%s: x = %p, y = %p\n", __func__, x, y);
 }
 
 static void
-my_pointer_task_opencl (const int *x, long *y)
+my_pointer_task_opencl (const int *x, short *y)
 {
   printf ("%s: x = %p, y = %p\n", __func__, x, y);
 }
 
 
 
-static void my_mixed_task (int *x, unsigned char z, const long *y)
+static void my_mixed_task (int *x, unsigned char z, const short *y)
   __attribute__ ((task));
-static void my_mixed_task_cpu (int *, unsigned char, const long *)
+static void my_mixed_task_cpu (int *, unsigned char, const short *)
   __attribute__ ((task_implementation ("cpu", my_mixed_task)));
-static void my_mixed_task_opencl (int *, unsigned char, const long *)
+static void my_mixed_task_opencl (int *, unsigned char, const short *)
   __attribute__ ((task_implementation ("opencl", my_mixed_task)));
 
 static void
-my_mixed_task_cpu (int *x, unsigned char z, const long *y)
+my_mixed_task_cpu (int *x, unsigned char z, const short *y)
 {
   printf ("%s: x = %p, y = %p, z = %i\n", __func__, x, y, (int) z);
 }
 
 static void
-my_mixed_task_opencl (int *x, unsigned char z, const long *y)
+my_mixed_task_opencl (int *x, unsigned char z, const short *y)
 {
   printf ("%s: x = %p, y = %p, z = %i\n", __func__, x, y, (int) z);
 }
@@ -70,7 +70,7 @@ main (int argc, char *argv[])
 
   static const unsigned char z = 0x77;
   int x[] = { 42 };
-  long *y;
+  short *y;
 
   y = malloc (sizeof *y);
   *y = 77;