aboutsummaryrefslogtreecommitdiff
path: root/src/prc1/parse.h
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-10-31 13:52:42 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-10-31 13:52:42 +0100
commitcc1cbe64a5953004c80b0da3026748ee3061bca0 (patch)
tree03c68b482be40479b2f73e0a63a79ffd3f39bcb1 /src/prc1/parse.h
parent4dbcfc991a4fb203ec2b50d950f59adb1ad61922 (diff)
downloadprc-cc1cbe64a5953004c80b0da3026748ee3061bca0.tar.gz
Use read-only references for complex types
This fixes a double-free error in constructs such as: types mystruct struct dummy int end myalias alias pointer to mystruct
Diffstat (limited to 'src/prc1/parse.h')
-rw-r--r--src/prc1/parse.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/prc1/parse.h b/src/prc1/parse.h
index 8b61d78..f0ae691 100644
--- a/src/prc1/parse.h
+++ b/src/prc1/parse.h
@@ -52,8 +52,15 @@ struct type
enum ttype {U, S, C, P, T, PTR, ARY, BUILTIN} type;
const struct tk *tk;
size_t sz, align;
- int sign;
- struct type *child, *next;
+ int sign, readonly;
+
+ union
+ {
+ const struct type *ro;
+ struct type *rw;
+ } child;
+
+ struct type *next;
union
{