[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Pointers to variable-length arrays are broken
From: |
Ivan Kozlov |
Subject: |
[Tinycc-devel] Pointers to variable-length arrays are broken |
Date: |
Fri, 03 Sep 2021 13:09:16 +0300 |
The following program miscompiles as of TCC 0.9.27:
#include <stdio.h>
int
main (void)
{
size_t n = 10;
int a[n];
printf ("%p\n%p\n", (void *)a, (void *)*&a);
}
The second address is off. GCC 10.2.0, among others, handles this correctly.
Pointers to constant-length arrays work as intended (and indeed have the same
representation as the address of the first element of the target array).
- [Tinycc-devel] Pointers to variable-length arrays are broken,
Ivan Kozlov <=