From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17929 invoked by alias); 22 Feb 2002 03:05:43 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 17748 invoked from network); 22 Feb 2002 03:05:34 -0000 Received: from unknown (HELO mail.cs.tu-berlin.de) (130.149.17.13) by sources.redhat.com with SMTP; 22 Feb 2002 03:05:34 -0000 Received: from platon.cs.tu-berlin.de (matzmich@platon.cs.tu-berlin.de [130.149.25.107]) by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id EAA12296; Fri, 22 Feb 2002 04:04:26 +0100 (MET) Received: (from matzmich@localhost) by platon.cs.tu-berlin.de (8.9.3/8.9.3) id EAA17069; Fri, 22 Feb 2002 04:04:26 +0100 (MET) Date: Thu, 21 Feb 2002 19:19:00 -0000 From: Michael Matz X-X-Sender: To: Andreas Jaeger , Jakub Jelinek cc: Subject: Re: 252.eon / current GCC In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-02/txt/msg01250.txt.bz2 Hi, On Thu, 21 Feb 2002, Andreas Jaeger wrote: > [... a compile error with 252.eon from SPEC2000 ...] A reduced testcase for this problem is: ----------------- template class Wrapper { public: Wrapper (T& a); Wrapper (const Wrapper& ref); }; template class Element { public: T * operator[](int x); }; void test() { char bla = 42; Element< Wrapper > elem; elem[1][1] = Wrapper (bla); } ------------------ The error is cause by this patch: 2002-02-20 Jakub Jelinek * typeck.c (cp_pointer_int_sum): Renamed from pointer_int_sum, call pointer_int_sum. In that process a certain thing got lost, namely the completion of the inner TREE_TYPE on which size_in_bytes() is applied. The below patch fixes it for me. I did not test the patch further. Neither bootstrapped nor regtested. No time because of moving, sorry. Ciao, Michael. -- 2002-02-21 Michael Matz * typeck.c (cp_pointer_int_sum): Complete inner type which is used later by size_in_bytes(). Index: typeck.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/cp/typeck.c,v retrieving revision 1.388 diff -u -p -r1.388 typeck.c --- typeck.c 20 Feb 2002 23:05:42 -0000 1.388 +++ typeck.c 22 Feb 2002 02:54:39 -0000 @@ -4076,8 +4076,17 @@ cp_pointer_int_sum (resultcode, ptrop, i enum tree_code resultcode; register tree ptrop, intop; { - if (!complete_type_or_else (TREE_TYPE (ptrop), ptrop)) + tree res_type = TREE_TYPE (ptrop); + + if (!complete_type_or_else (res_type, ptrop)) return error_mark_node; + + /* pointer_int_sum() uses size_in_bytes() on the TREE_TYPE(res_type) + in certain circumstance (when it's valid to do so). So we need + to make sure it's complete. We don't need to check here, if we + can actually complete it at all, as those checks will be done in + pointer_int_sum() anyway. */ + (void) complete_type (TREE_TYPE (res_type)); return pointer_int_sum (resultcode, ptrop, fold (intop)); }