tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] variable lenght array parameter declaration bug


From: Tyge Løvset
Subject: Re: [Tinycc-devel] variable lenght array parameter declaration bug
Date: Fri, 3 Sep 2021 10:36:21 +0200

I think this can be splitted into two issues. 

a. "8: error: '__nmatch' undeclared"
b. "8: error: constant _expression_ expected"   (when declaring 'size_t __nmatch = 1'  before the function).

Fix for a: __nmatch (and all previous parameters) must be considered belonging to the outside scope variables.
Fix for b: If it is a non-constant integer _expression_, just ignore it as if [] was given. (I assume only constant expressions are utilized for bounds checking when enabled).

PS. Is anyone currently tracking reported bugs?

On Thu, 2 Sept 2021 at 09:54, <arnold@skeeve.com> wrote:
Hi All.

Latest mob (and earlier) don't handle declaration of a variable length
array parameter when the length is specified by an earlier parameter. Here
is a test file:

-------------------
#include <stdlib.h>

typedef struct { int x, y; } regex_t;
typedef struct { int x, y; } regmatch_t;

extern int regexec (const regex_t *__preg,
                    const char *__String, size_t __nmatch,
                    regmatch_t __pmatch[__nmatch],
                    int __eflags);
-------------------

This goes through GCC, pcc, and clang with no problems.  Can someone
fix this?  After recent changes in GNULIB, I can no longer compile
gawk with tcc because of this issue.

Thanks!

Arnold

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

reply via email to

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