public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tilo at pruetz dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libobjc/18255] New: Protocols are not initialized correctly
Date: Sun, 31 Oct 2004 17:13:00 -0000	[thread overview]
Message-ID: <20041031171351.18255.tilo@pruetz.net> (raw)

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


             reply	other threads:[~2004-10-31 17:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-31 17:13 tilo at pruetz dot net [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041031171351.18255.tilo@pruetz.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).