* built in memset
@ 1998-04-21 23:21 John Carr
1998-04-23 19:37 ` Jim Wilson
0 siblings, 1 reply; 2+ messages in thread
From: John Carr @ 1998-04-21 23:21 UTC (permalink / raw)
To: egcs
My alias changes revealed a bug in setting MEM_IN_STRUCT_P when
calling builtin memset. This patch improves the situation but there
are still potential bugs. memcpy probably also needs to be fixed.
I think it would be correct to always set MEM_IN_STRUCT_P, or always
set it except in cases where the argument is the address of a scalar
(i.e. &foo but not ptr = &foo; memset(ptr).)
The specific bug was compiling cse.c:simplify_plus_or_minus:
rtx ops[8];
bzero ((char *) ops, sizeof ops);
After removing casts, ops is a pointer to a pointer, not a pointer to
a structure. That is all the existing code checks: is the type a
pointer to aggregate.
Tue Apr 21 20:36:28 1998 John Carr <jfc@mit.edu>
* expr.c (expand_builtin, case MEMSET): Set MEM_IN_STRUCT_P
if the argument is the adress of a structure or array.
*** expr.c 1998/04/16 23:56:03 1.48
--- expr.c 1998/04/22 00:36:51
*************** expand_builtin (exp, target, subtarget,
*** 8634,8640 ****
/* There could be a void* cast on top of the object. */
while (TREE_CODE (dest) == NOP_EXPR)
dest = TREE_OPERAND (dest, 0);
! type = TREE_TYPE (TREE_TYPE (dest));
MEM_IN_STRUCT_P (dest_mem) = AGGREGATE_TYPE_P (type);
dest_addr = clear_storage (dest_mem, len_rtx, dest_align);
--- 8634,8646 ----
/* There could be a void* cast on top of the object. */
while (TREE_CODE (dest) == NOP_EXPR)
dest = TREE_OPERAND (dest, 0);
!
! if (TREE_CODE (dest) == ADDR_EXPR)
! /* If this is the address of an object, check whether the
! object is an array. */
! type = TREE_TYPE (TREE_OPERAND (dest, 0));
! else
! type = TREE_TYPE (TREE_TYPE (dest));
MEM_IN_STRUCT_P (dest_mem) = AGGREGATE_TYPE_P (type);
dest_addr = clear_storage (dest_mem, len_rtx, dest_align);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: built in memset
1998-04-21 23:21 built in memset John Carr
@ 1998-04-23 19:37 ` Jim Wilson
0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 1998-04-23 19:37 UTC (permalink / raw)
To: John Carr; +Cc: egcs
* expr.c (expand_builtin, case MEMSET): Set MEM_IN_STRUCT_P
if the argument is the adress of a structure or array.
This patch looks OK to me.
Jim
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-04-23 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-21 23:21 built in memset John Carr
1998-04-23 19:37 ` Jim Wilson
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).