This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH] Fix PR objc/18255, sub protocals are not being initialized


The problem is that sub protocals are not initializing so we get a
seg fault at runtime while trying to sending a message to the
protocal from the supper protocal. This problem only effects the
GNU runtime.

This patch adds the supper protocals to static instances and fixes
the bug.

OK? Bootstrapped and test on powerpc-darwin with -fgnu-runtime when
running the testsuite.

Thanks,
Andrew Pinski

Testcase:
#include <objc/Protocol.h>
#include <stdlib.h>

@protocol a
- aMethod;
@end

@protocol b <a>
- bMethod;
@end

int main(int argc, char **argv)
{
  if ([@protocol(b) descriptionForInstanceMethod: @selector(aMethod)]
      == NULL)
    abort ();
  return 0;
}

ChangeLog:

	* objc-act.c (add_protocal_to_static_instances): New function.
	(objc_build_protocol_expr): Call it instead of adding to the list
	manually.

Attachment: fixPR18255.diff.txt
Description: Text document


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