[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] function pointer problem on x86_64/macos/riscv

From: Herman ten Brugge
Subject: [Tinycc-devel] function pointer problem on x86_64/macos/riscv
Date: Thu, 16 Jul 2020 17:00:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]