This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] libobjc: Properly handle classes without instance variables in class_copyIvarList ().
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Dimitris Papavasiliou <dpapavas at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>, Mike Stump <mikestump at comcast dot net>, Stan Shebs <stanshebs at earthlink dot net>
- Date: Thu, 8 Jan 2015 21:38:48 -0800
- Subject: Re: [PATCH] libobjc: Properly handle classes without instance variables in class_copyIvarList ().
- Authentication-results: sourceware.org; auth=none
- References: <549AF7D6 dot 5000708 at gmail dot com>
On Wed, Dec 24, 2014 at 9:28 AM, Dimitris Papavasiliou
<dpapavas@gmail.com> wrote:
> Hello,
>
> The attached patch fixes an issue reported a couple of years ago in Bug
> 51891 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51891). The problem is
> caused because classes without instance variables have no ivar list at all,
> so that their ivars pointer is NULL, but the code in class_copyIvarList ()
> is unaware of this.
>
> That this is in fact so can be easily verified by checking the code of
> class_addIvar in the same source file, where the ivars list is allocated
> when the first ivar is added. The code there also checks for a NULL ivars
> pointer.
>
> The patch also adds a simple test-case for this issue. I think that the
> ChangeLog entry should be something along the lines of:
>
> 2014-12-24 Dimitris Papavasiliou <dpapavas@gmail.com>
>
> PR libobjc/51891
> * libobjc/ivars.c: Add a check for classes without instance
> variables, which have a NULL ivar list pointer.
> * gcc/testsuite/objc.dg/gnu-api-2-class.m: Add a test case
> for the above change.
>
> I hope I got the formatting right. I've run make -k check-objc and all
> tests pass without problems.
>
> Let me know if there are any problems, or if I can do anything else to
> facilitate the acceptance of the patch.
This is ok.
Thanks,
Andrew
>
> Regards,
> Dimitris
>