public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libobjc/18255] New: Protocols are not initialized correctly
@ 2004-10-31 17:13 tilo at pruetz dot net
  2004-10-31 18:45 ` [Bug libobjc/18255] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: tilo at pruetz dot net @ 2004-10-31 17:13 UTC (permalink / raw)
  To: gcc-bugs

Given this small Objective-C program:

<SNIP>

#include <objc/Protocol.h>

@protocol a

- aMethod;

@end


@protocol b <a>

- bMethod;

@end


int main(int argc, char **argv)
{
    if ([@protocol(b) descriptionForInstanceMethod: @selector(aMethod)] != NULL)
printf("Ok\n");
}

</SNIP>

Compiling with

gcc -lobjc

Running

a.out

-> Segmentation fault


The segfault occurs in the libobjc when the Protocol tries to check it's
parents. The 'protocols'-Array contains a pointer which does _not_ point to the
parent protocol! That's why the prog crashes.

When inserting the line

    if ([@protocol(a) descriptionForInstanceMethod: @selector(aMethod)] != NULL)
printf("Ok\n");

as first line in the main-method all is good. The protocol 'a' (the parent) is
initialized and 'b' finds it's parent and the line that caused the crash before
is running without problems.

This is extremly critical to me and maybe a patch could be posted here so I can
patch my gcc?


P.S.: I set the component to 'libobjc' because I think that it's containing the
objc-runtime. Is this correct?

-- 
           Summary: Protocols are not initialized correctly
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: libobjc
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tilo at pruetz dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18255


^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <bug-18255-9554@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-18255-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2010-10-18  8:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-31 17:13 [Bug libobjc/18255] New: Protocols are not initialized correctly tilo at pruetz dot net
2004-10-31 18:45 ` [Bug libobjc/18255] " pinskia at gcc dot gnu dot org
2004-10-31 19:06 ` [Bug objc/18255] [GNU runtime] " pinskia at gcc dot gnu dot org
2004-10-31 19:10 ` pinskia at gcc dot gnu dot org
2004-10-31 19:26 ` pinskia at gcc dot gnu dot org
2004-10-31 22:47 ` pinskia at gcc dot gnu dot org
2004-10-31 22:49 ` pinskia at gcc dot gnu dot org
2004-11-22 17:36 ` tilo at pruetz dot net
2004-12-12  4:33 ` pinskia at gcc dot gnu dot org
2005-08-03 13:50 ` pinskia at gcc dot gnu dot org
2005-10-01  9:02 ` tilo at pruetz dot net
     [not found] <bug-18255-9554@http.gcc.gnu.org/bugzilla/>
2005-10-04 19:29 ` pinskia at gcc dot gnu dot org
2006-01-17 16:53 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18255-4@http.gcc.gnu.org/bugzilla/>
2010-10-17 10:11 ` nicola at gcc dot gnu.org
2010-10-17 10:12 ` nicola at gcc dot gnu.org
2010-10-18  8:22 ` tilo at pruetz dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).