public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* TREE_CST_RTL and CONSTRUCTORs
@ 1998-04-22  4:19 Martin von Loewis
  1998-04-23 23:23 ` Jim Wilson
  1998-04-23 23:23 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Martin von Loewis @ 1998-04-22  4:19 UTC (permalink / raw)
  To: egcs

The macro TREE_CST_RTL accesses the real_cst variant of the tree, so
I first required it to be a REAL_CST. Then I found that it is also used
to access STRING_CST nodes. This is fine, as both structures start
with

struct tree_*_cst
{
  char common[sizeof (struct tree_common)];
  struct rtx_def *rtl;

and the macro accesses rtl. Now, the comment says that it is also used
to access CONSTRUCTOR expressions, which has the lay-out

struct tree_exp
{
  char common[sizeof (struct tree_common)];
  int complexity;

So we really have the complexity field here. This problem is exposed in
gcc.c-torture/compile/920501-11.c, where output_constant_def is called
with a CONSTRUCTOR.

What is the story here? Is this intended, and gcc requires sizeof(int)
== sizeof(tree)? If so, I should relax the check to also accept
constructors in TREE_CST_RTL. If not, gcc should be changed.

Regards,
Martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TREE_CST_RTL and CONSTRUCTORs
  1998-04-22  4:19 TREE_CST_RTL and CONSTRUCTORs Martin von Loewis
  1998-04-23 23:23 ` Jim Wilson
@ 1998-04-23 23:23 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 1998-04-23 23:23 UTC (permalink / raw)
  To: Martin von Loewis; +Cc: egcs

On Wed, Apr 22, 1998 at 10:37:42AM +0200, Martin von Loewis wrote:
> What is the story here? Is this intended, and gcc requires sizeof(int)
> == sizeof(tree)?

It clearly cannot, because on almost all 64-bit hosts this is false.


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TREE_CST_RTL and CONSTRUCTORs
  1998-04-22  4:19 TREE_CST_RTL and CONSTRUCTORs Martin von Loewis
@ 1998-04-23 23:23 ` Jim Wilson
  1998-04-23 23:23 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Jim Wilson @ 1998-04-23 23:23 UTC (permalink / raw)
  To: Martin von Loewis; +Cc: egcs

	What is the story here? Is this intended, and gcc requires sizeof(int)
	== sizeof(tree)? If so, I should relax the check to also accept
	constructors in TREE_CST_RTL. If not, gcc should be changed.

This is a bug.

Since a CONSTRUCTOR is defined by tree.def to have two operands, and
TREE_OPERANDS(x,1) is CONSTRUCTOR_ELTS, it appears that the intent was that
TREE_OPERANDS(x,0) would be TREE_CST_RTL.  This does not happen because of
the complexity field.

I suspect we need a CONSTRUCTOR_RTL macro which looks like the
CALL_EXPR_RTL macro, and then we need to use it instead of TREE_CST_RTL
for CONSTRUCTORs.

Jim

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-04-23 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-22  4:19 TREE_CST_RTL and CONSTRUCTORs Martin von Loewis
1998-04-23 23:23 ` Jim Wilson
1998-04-23 23:23 ` Richard Henderson

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).