This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 252.eon / current GCC
- From: Andreas Jaeger <aj at suse dot de>
- To: Michael Matz <matzmich at cs dot tu-berlin dot de>
- Cc: Jakub Jelinek <jakub at redhat dot com>, <gcc-patches at gcc dot gnu dot org>,gcc at gcc dot gnu dot org
- Date: Fri, 22 Feb 2002 11:55:19 +0100
- Subject: Re: 252.eon / current GCC
- References: <Pine.GSO.4.33.0202220357140.14671-100000@platon>
- Reply-to: gcc-patches at gcc dot gnu dot org, matzmich at cs dot tu-berlin dot de
Michael Matz <matzmich@cs.tu-berlin.de> writes:
> 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 T>
> class Wrapper {
> public:
> Wrapper (T& a);
> Wrapper (const Wrapper<char>& ref);
> };
>
> template <class T>
> class Element {
> public:
> T * operator[](int x);
> };
>
> void test()
> {
> char bla = 42;
> Element< Wrapper <unsigned char> > elem;
> elem[1][1] = Wrapper<char> (bla);
> }
> ------------------
>
> The error is cause by this patch:
>
> 2002-02-20 Jakub Jelinek <jakub@redhat.com>
> * 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.
I've bootstrapped and regtested the patch on i686-linux-gnu. Ok to
commit?
Thanks Michael for investigating this.
Andreas
P.S. Here's the patch again since I'm including gcc-patches this time.
2002-02-21 Michael Matz <matz@suse.de>
* 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));
}
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj