This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Disallow subtracting pointers to empty structs (PR c/58346)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 23 Jan 2014 17:46:47 +0000
- Subject: Re: [C PATCH] Disallow subtracting pointers to empty structs (PR c/58346)
- Authentication-results: sourceware.org; auth=none
- References: <20140113163226 dot GD4458 at redhat dot com> <20140113164859 dot GE4458 at redhat dot com> <20140113204839 dot GF4458 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1401142134140 dot 10324 at digraph dot polyomino dot org dot uk> <20140115102737 dot GJ4458 at redhat dot com> <20140115103540 dot GY892 at tucnak dot redhat dot com> <20140115135037 dot GL4458 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1401152117180 dot 24518 at digraph dot polyomino dot org dot uk> <20140116185242 dot GG8907 at redhat dot com> <20140123091524 dot GV8907 at redhat dot com>
On Thu, 23 Jan 2014, Marek Polacek wrote:
> > 2014-01-16 Marek Polacek <polacek@redhat.com>
> >
> > PR c/58346
> > c-family/
> > * c-common.c (pointer_to_zero_sized_aggr_p): New function.
> > * c-common.h: Declare it.
> > cp/
> > * typeck.c (pointer_diff): Give an error on arithmetic on pointer to
> > an empty aggregate.
> > c/
> > * c-typeck.c (pointer_diff): Give an error on arithmetic on pointer to
> > an empty aggregate.
> > testsuite/
> > * c-c++-common/pr58346-1.c: New test.
> > * c-c++-common/pr58346-2.c: New test.
> > * c-c++-common/pr58346-3.c: New test.
OK.
--
Joseph S. Myers
joseph@codesourcery.com