public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Nicola Pero <nicola@brainstorm.co.uk>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c/3711: ICE in instantiate_virtual_regs_1, at function.c:3880
Date: Tue, 26 Mar 2002 03:56:00 -0000	[thread overview]
Message-ID: <20020326115601.30497.qmail@sources.redhat.com> (raw)

The following reply was made to PR c/3711; it has been noted by GNATS.

From: Nicola Pero <nicola@brainstorm.co.uk>
To: Richard Henderson <rth@redhat.com>
Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
   GNUstep Developers <gnustep-dev@gnu.org>
Subject: Re: c/3711: ICE in instantiate_virtual_regs_1, at function.c:3880
Date: Tue, 26 Mar 2002 11:53:03 +0000 (GMT)

 >  > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3711
 > 
 > Incidentally, I believe this test case to be in error.  The type of the 
 > argument in the caller and the callee is different.  In particular, the 
 > size of the argument is static in the caller and variable in the callee. 
 >  Whether or not an argument has variable size affects calling 
 > conventions, and thus affects how the callee should find the argument in 
 > varargs.
 > 
 > A correct test case would have the caller have a variable sized 
 > structure as well.
 
 Hmmm ... well this testcase arrives from a real example ... forwarding
 code in some advanced OO stuff which worked perfectly well with all GCC
 releases up to now (code from mframe.m in gnustep-base).
 
 If that is wrong, other code is wrong ... and well variable size structs
 are much less useful ... are you meaning that if I have
 
 int size = 255;
 
 struct
 {
   char text[size];
 } SMSmessage;
 
 then I can't pass the SMSmessage to a function accepting a struct {char
 text[255]; } as argument ?
 
 So I can use SMSmessages in place of a struct {char text[255];} everywhere
 I want, but I can't pass it in place of a struct {char text[255];} to a
 function ?
 
 This is very confusing for users I must say.  And it is not how it worked
 in previous versions of the compiler.
 
 Anyway - if that does not longer work on GCC 3.1, at least let me know how
 do we make our code to work with GCC 3.1.
 
 I think you understood what the function in the testcase "wants/needs" to
 do - which is that it can be called with an arbitrary struct (fixed size)
 as the second argument, and it is informed of the size of the struct from
 the first argument (which is just to say, a source providing the info at
 runtime), and it needs to be able to access the bytes in the struct.
 
 This is needed to implement proper forwarding of methods when there are
 structs.
 
 I guess there might be other problems then - here is an excerpt of code
 needing to return a struct of a certain (fixed) size, which is only known
 when the function is called -
 
     case _C_ARY_B:
     case _C_STRUCT_B:
     case _C_UNION_B:
       {
 	typedef struct {
 	  char	val[size];
 	} block;
 	inline block retframe_block(void *rframe)
 	{
 	  __builtin_return (rframe);
 	}
 	*(block*)buffer = retframe_block(retframe);
 	break;
       }
 
 This works with GCC < 3.1.  If what you say is true, this will no longer
 work with GCC 3.1, because 'block' is a variable size struct, and can't
 replace a fixed size struct as the return type.
 
 So - question - since this stuff which worked fine on all previous
 compilers no longer works, and you say the code is broken - ok then how do
 we fix the code ?
 
 
 


             reply	other threads:[~2002-03-26 11:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-26  3:56 Nicola Pero [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-04-25 23:14 rth
2002-03-28  9:26 Richard Henderson
2002-03-28  7:06 Nicola Pero
2002-03-26  9:46 Richard Henderson
2002-03-25 16:26 Richard Henderson

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=20020326115601.30497.qmail@sources.redhat.com \
    --to=nicola@brainstorm.co.uk \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@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).