* Re: 252.eon / current GCC
[not found] <ho7kp72fmc.fsf@gee.suse.de>
@ 2002-02-21 19:19 ` Michael Matz
2002-02-22 2:57 ` Andreas Jaeger
0 siblings, 1 reply; 2+ messages in thread
From: Michael Matz @ 2002-02-21 19:19 UTC (permalink / raw)
To: Andreas Jaeger, Jakub Jelinek; +Cc: gcc
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.
--
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));
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: 252.eon / current GCC
2002-02-21 19:19 ` 252.eon / current GCC Michael Matz
@ 2002-02-22 2:57 ` Andreas Jaeger
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Jaeger @ 2002-02-22 2:57 UTC (permalink / raw)
To: Michael Matz; +Cc: Jakub Jelinek, gcc-patches, gcc
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-02-22 10:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <ho7kp72fmc.fsf@gee.suse.de>
2002-02-21 19:19 ` 252.eon / current GCC Michael Matz
2002-02-22 2:57 ` Andreas Jaeger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).