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

Re: [PATCH] Fix for the C++ testcase submitted today


On Fri, May 05, 2000 at 12:36:31PM -0700, Jason Merrill wrote:
> >>>>> Jason Merrill <jason@cygnus.com> writes:
> 
> >>>>> Jakub Jelinek <jakub@redhat.com> writes:
>  >> This patch fixes the C++ failure with static class data member of the same
>  >> type as the containing class I posted today.
> 
>  > I think it's just papering over the real bug, which is that we don't layout
>  > bar::baz properly when bar is complete.  That's what
>  > hack_incomplete_structures is supposed to be doing.
> 
> That wasn't quite right; for a static member, the layout_type code is
> supposed to handle it.  Here's a fix for that bug.  Does it solve the
> problem you were having?

Yes, this solves the align.C testcase. Please commit it.
Actually, I spent quite some time going similar way how your patch does it,
when I saw program below fails as well and decided not to do it that way.

>  What problem were you seeing as a result, anyway?

Internal compiler error in `move_by_pieces', at expr.c:1484

Anyway, following program still crashes (unless my patch is in).
Attached patch cures it as well, but I don't have enough bandwidth over slow
modem to check that nor bootstrap.

// Build don't link:

class ext;
class bar {
public:
    bar() { rw = 0; }
    static const ext baz;
private:
    unsigned char rw;
};
char buf[4096];
void foo(int len)
{
    memcpy(buf,&bar::baz,sizeof(bar));
}

> This bug didn't cause the testcase to fail for me.

Most probably because on your platform some other path of __builtin_memcpy
expansion happened.

--- gcc/tree.c.jj	Fri May  5 22:09:58 2000
+++ gcc/tree.c	Fri May  5 22:10:16 2000
@@ -1066,7 +1066,7 @@ make_node (code)
 
     case 'd':
       if (code != FUNCTION_DECL)
-	DECL_ALIGN (t) = 1;
+	DECL_ALIGN (t) = BITS_PER_UNIT;
       DECL_IN_SYSTEM_HEADER (t) = in_system_header;
       DECL_SOURCE_LINE (t) = lineno;
       DECL_SOURCE_FILE (t) = 

	Jakub

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