kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

6_5_6_01_ptr_diff_assign_to_long.c (480B)


      1 /* ยง6.5.6 -- pointer subtraction yields ptrdiff_t (a signed integer type),
      2  * so the result is assignable to a wider signed integer without a cast.
      3  * Currently rejected: kit leaves the cg stack typed as `T*` after
      4  * BO_ISUB on two pointer operands, so the integer assignment trips the
      5  * "incompatible assignment from pointer to integer" constraint check. */
      6 int test_main(void) {
      7   int a[8] = {0};
      8   int* p = a + 7;
      9   int* q = a + 4;
     10   long d = p - q;
     11   return (int)d + 39;
     12 }