This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

GCC and C89 Defect Report 106


I've been running C89 conformance suites against my preprocessor
changes.  In the process I found a bug in our handling of void
expressions.  This code is taken more or less verbatim from Defect
Report #106 against C89
[http://anubis.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_106.html].

void
dr106_1(void *pv, int i)
{
	*pv;
	i ? *pv : *pv;
	*pv, *pv;
}

void
dr106_2(const void *pcv, volatile void *pvv, int i)
{
	*pcv;
	i ? *pcv : *pcv;
	*pcv, *pcv;

	*pvv;
	i ? *pvv : *pvv;
	*pvv, *pvv;
}

Current CVS rejects both these functions with a stack of
"dereferencing pointer to incomplete type" errors, in both normal and
pedantic mode.  The Defect Report says that both functions are
well-formed; I believe the logic is that void pointers may be
dereferenced in void context (and the operation is ignored, even if
the pointer is volatile).

This is not an important issue, except in so far as it means we are
not 100% C89 conformant.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]