GCC and C89 Defect Report 106

Zack Weinberg zack@wolery.cumb.org
Sat Jul 1 14:43:00 GMT 2000


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


More information about the Gcc-bugs mailing list