This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: GCC and C89 Defect Report 106
- To: Geoff Keating <geoffk at cygnus dot com>
- Subject: Re: GCC and C89 Defect Report 106
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Sat, 1 Jul 2000 21:39:27 -0700
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <20000701144349.D23237@wolery.cumb.org> <jmd7kxdvsj.fsf@envy.cygnus.com>
On Sat, Jul 01, 2000 at 09:02:20PM -0700, Geoff Keating wrote:
> > This is not an important issue, except in so far as it means we are
> > not 100% C89 conformant.
>
> Could you install these in the testsuite (as compile tests I guess),
> and mark them as xfail, and put in a comment saying that they are from
> DR106? That way at least we'll remember.
I'll do better: here's the fix. Simple case of code not having been
updated for the recent change that made void an incomplete type.
zw
* c-typeck.c (build_indirect_ref): Use COMPLETE_OR_VOID_TYPE_P
and VOID_TYPE_P.
* gcc.c-torture/compile/20000701-1.c: New test.
===================================================================
Index: c-typeck.c
--- c-typeck.c 2000/06/26 16:42:22 1.74
+++ c-typeck.c 2000/07/02 04:37:52
@@ -1217,12 +1217,12 @@ build_indirect_ref (ptr, errorstring)
register tree ref = build1 (INDIRECT_REF,
TYPE_MAIN_VARIANT (t), pointer);
- if (!COMPLETE_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE)
+ if (!COMPLETE_OR_VOID_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE)
{
error ("dereferencing pointer to incomplete type");
return error_mark_node;
}
- if (TREE_CODE (t) == VOID_TYPE && skip_evaluation == 0)
+ if (VOID_TYPE_P (t) && skip_evaluation == 0)
warning ("dereferencing `void *' pointer");
/* We *must* set TREE_READONLY when dereferencing a pointer to const,
===================================================================
Index: testsuite/gcc.c-torture/compile/20000701-1.c
--- testsuite/gcc.c-torture/compile/20000701-1.c Tue May 5 13:32:27 1998
+++ testsuite/gcc.c-torture/compile/20000701-1.c Sat Jul 1 21:38:47 2000
@@ -0,0 +1,19 @@
+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;
+}