This is the mail archive of the gcc-bugs@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]

[Bug middle-end/16567] New: Nested function and variable-sized structure ICE


The following GNU C testcase ICEs with every compiler version tested
from 2.6.3 to recent mainline.  With mainline 3.5.0 20040710 on
i686-pc-linux-gnu, the error is:

t.c: In function `nested':
t.c:12: internal compiler error: in make_decl_rtl, at varasm.c:758
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

With 3.4.1, the error is:

t.c: In function `nested':
t.c:12: internal compiler error: in expand_expr_real, at expr.c:6638
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

The proper fix may well involve getting rid of variable-sized structures
in GNU C, but I don't know whether the problem can be triggered with
equivalent testcases in other languages (all ICEs are in various middle-end
files).

#include <stddef.h>

extern int printf (const char *, ...);
extern void *memset (void *, int, size_t);

int bar (int (*)(), int, void *);

int
main(int argc, char **argv)
{
  struct s { int a; char b[argc]; };
  int nested (struct s x) { return x.a + sizeof(x); }
  struct s t;
  memset (&t, 0, sizeof(t));
  t.a = 123;
  printf("%d\n", bar (nested, argc, &t));
  return 0;
}

-- 
           Summary: Nested function and variable-sized structure ICE
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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