From 1d3b107d5fe918935aba91f655cb5b9b9e543073 Mon Sep 17 00:00:00 2001 From: Chris St John Date: Tue, 25 Mar 2014 17:59:51 +0000 Subject: [PATCH] Treat array[1] as equivalent to pointer for purposes of -> operator --- src/exprNode.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/exprNode.c b/src/exprNode.c index d6c581a..a6fd391 100644 --- a/src/exprNode.c +++ b/src/exprNode.c @@ -4206,7 +4206,14 @@ exprNode_arrowAccessAux (/*@only@*/ exprNode s, /*@observer@*/ fileloc loc, checkMacroParen (s); - (void) ctype_fixArrayPtr (tr); /* REWRITE THIS */ + /* CBS, 2014-03-25 + * treat single-element arrays as equivalent to pointers + * (consider making this optional) + */ + if (ctype_isFixedArray(tr) && ctype_getArraySize(tr) == 1) + { + tr = ctype_makePointer (ctype_baseArrayPtr (tr)); + } if (ctype_isRealPointer (tr)) {