While testing gmp on the x86_64 target I discovered a fuction pointer bug.
(reuse in directory tests/mpf)

The code:

#include <stdio.h>

typedef int (*func) (int);
func allfunc[] = { putchar };

int main(void) {
  printf ("%d\n", allfunc[0] == putchar);
  return 0;
}

prints 0 on x86_64, macos and riscv (all other targets (i386, arm, arm64, win32, win64) print 1).

There seems to be something wrong with relocation.
The allfunc[0] points to the got table. The putchar to the externel symbol.

    Herman



_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to