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

Compound Literals patch breaks kernel and glibc! (Was Re: Testcasefor a new ICE)


Bo Thorsen <bo@sonofthor.dk> writes:

> This test case fails on mainline now for i386 and x86-64. The problem is hit 
> in compilation of the kernel and glibc. The testcase here is distilled from 
> linux/drivers/char/mem.c:
>
> *** --- ***
>
> typedef struct { long p; } pt;
>
> inline pt f(pt _p)
> {
>   long p = _p.p;
>
>   return (pt) { (p) };
> }
>
> static int mmap_mem(void)
> {
>   pt p;
>   p = f(p);
>
>   return 0;
> }
>
> *** --- ***
> [...]
> mem1.i: In function `mmap_mem':
> mem1.i:5: Internal compiler error in make_decl_rtl, at varasm.c:832

As suggested by several people, I've done a binary search for the
patch that's responsible for this.  The program fails since the
introduction of Joseph's patch for compound literals (ChangeLog is
appended below)

Just for reference:
With cvs update -D "2001-12-04 23:59" it fails but works with
"2001-12-04 23:52".  My timezone is CET (UTC+1).

Joseph, can you have a look at the above test case?  It fails on
i686-linux-gnu with -O2 (but not with -fno-inline).  

This bug prevents compilation of glibc and kernel on a number of
platforms (AFAIK i386, x86-64 and ia64).

Andreas

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.12144
retrieving revision 1.12145
diff -u -p -r1.12144 -r1.12145
--- ChangeLog	2001/12/04 22:49:09	1.12144
+++ ChangeLog	2001/12/04 22:55:33	1.12145
@@ -1,5 +1,24 @@
 2001-12-04  Joseph S. Myers  <jsm28@cam.ac.uk>
 
+	* c-common.def (COMPOUND_LITERAL_EXPR): New.
+	* c-common.c (c_expand_expr): Handle COMPOUND_LITERAL_EXPR.
+	(c_staticp): New function.
+	* c-common.h (COMPOUND_LITERAL_EXPR_DECL): New.
+	(c_staticp): Declare.
+	* c-typeck.c (default_function_array_conversion, build_unary_op):
+	Don't handle CONSTRUCTOR specially.
+	(lvalue_p, mark_addressable): Handle COMPOUND_LITERAL_EXPR.
+	* c-decl.c (build_compound_literal): New function.
+	* c-tree.h (build_compound_literal): Declare.
+	* c-parse.in (primary): Use build_compound_literal.
+	* c-lang.c (LANG_HOOKS_STATICP): Define.
+	* objc/objc-lang.c (LANG_HOOKS_STATICP): Likewise.
+	* doc/c-tree.texi: Document COMPOUND_LITERAL_EXPR.
+	* doc/extend.texi: Update documentation of compound literals.
+	Fixes PR c/4787.
+
+2001-12-04  Joseph S. Myers  <jsm28@cam.ac.uk>
+
 	* langhooks.h (struct lang_hooks): Add staticp.
 	* langhooks-def.h (lhd_staticp, LANG_HOOKS_STATICP): New.
 	(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_STATICP.

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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