This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/16567] Nested function and variable-sized structure ICE
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2004 15:25:33 -0000
- Subject: [Bug middle-end/16567] Nested function and variable-sized structure ICE
- References: <20040715145525.16567.jsm28@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jsm at polyomino dot org dot uk 2004-07-15 15:25 -------
Subject: Re: Nested function and variable-sized
structure ICE
On Thu, 15 Jul 2004, bangerth at dealii dot org wrote:
> BTW, the code is definitely invalid (even leaving aside the matter of
> variable-sized structures). You declare
> int bar (int (*)(), int, void *);
> and call it with
> int nested (struct s x) { return x.a + sizeof(x); }
> bar (nested, argc, &t);
> Note that &nested does not satisfy the signature that bar() expects
> as first argument. It seems, however, as if we never even get to
> the point where gcc would like to check for this, it ICEs before that.
I deliberately declare bar's first argument with an old-style
non-prototype declaration precisely because a matching prototype can't be
written at that point - but &nested can match a simple "pointer to
function returning int"! (The original two-file testcase
<http://gcc.gnu.org/ml/gcc/2004-07/msg00776.html> was intended to be a
valid illustration of how variable-sized arguments are part of the C ABI,
which had the unintended effect of showing the ABI to be completely
irrelevant for this code because all versions of GCC ICE on it.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16567