Hi, it looks it has been fixed on mod (tested on Fedora x64).

Official tcc versions are quite old and the is no sign that a new official 
version will soon come out.

If you do serious work with tcc I strongly suggest you use mod.

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On 
Behalf Of ???
Sent: Monday, March 07, 2022 03:14
To: tinycc-devel
Subject: [Tinycc-devel] tcc assertion fail at x86_64-gen.c:441

 

Reproducer:

 

$ cat new.c # can be found in attachment

void abort(void);
int ii;
typedef struct {
} raw_spinlock_t;
typedef struct {
  raw_spinlock_t raw_lock;
} spinlock_t;
raw_spinlock_t one_raw_spinlock(void) {
  raw_spinlock_t raw_lock;
  ii++;
  return raw_lock;
}
int main(void) {
  spinlock_t lock =
      (spinlock_t){.raw_lock = one_raw_spinlock()};
  int ctf0_idx;
  ctf0_idx = (int)0x00000000;
  int ctf0_constval;
  ctf0_constval = (int)0x00000000;
  int *ctf0_arr[] = {&ctf0_constval};
  int ctf1_idx;
  ctf1_idx = (int)0x00000000;
  int ctf1_constval;
  ctf1_constval = (int)0x00000000;
  int *ctf1_arr[] = {&ctf1_constval};
  if (((*ctf0_arr[ctf0_idx]) | (*ctf1_arr[ctf1_idx])) != 1)
    abort();
  return 0;
}

 

$ tcc -O0 new.c

tcc: x86_64-gen.c:441: load: Assertion `((ft & VT_BTYPE) == VT_INT) || ((ft & 
VT_BTYPE) == VT_LLONG) || ((ft & VT_BTYPE) == VT_PTR) || ((ft & VT_BTYPE) == 
VT_FUNC)' failed.

[1]    115530 abort (core dumped)  tcc -O0 new.c

 

my tcc version is (ubuntu 18.04)

$ tcc -v

tcc version 0.9.27 (x86_64 Linux)

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

Reply via email to