tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] Strange bug found?


From: K K
Subject: [Tinycc-devel] Strange bug found?
Date: Thu, 20 Feb 2020 07:08:48 +0000

Hi all,
am I wrong or is the following a bug in tinycc? I found this using the last git commit (btw. git repo is currently not working again) and also in official 0.9.27, both on Windows.

The output of the follwing short code is:
10 = 10 = 9, but of course should be 10 = 10 = 10
The position of the marked line "double d = 0;" does not change the wrong behaviour as long as it is before "double b[n];" Changing the line to "int i = 0;" leads to correct behaviour.

#include <stdio.h>
#define ARRAYSIZE(a) (1[&(a)] - (a))
void main() {
  double a[10];
  size_t n = 10;
  double d = 0; // <-- no failure if this is removed
  double b[n];
  printf("%u = %u = %u\n", ARRAYSIZE(a), n,   ARRAYSIZE(b));
}

Sincerely,
Kernel

reply via email to

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