public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: egcs-2.93.08 19990215 sparc-sun-solaris2.5 bootstrap fails (genrecog)
       [not found] <199902160235.VAA22211@caip.rutgers.edu>
@ 1999-02-16 21:33 ` Alexandre Oliva
  1999-02-28 22:53   ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Oliva @ 1999-02-16 21:33 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs-bugs, egcs

On Feb 16, 1999, "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> wrote:

> 	I am getting bootstrap failures on sparc's for egcs-2.93.08
> 19990215.  I initially reported an identical problem on SunOS4 with
> --enable-c-cpplib, however it occurs even with no special options.  I.e. 
> its not specific to cpplib.  Both solaris and SunOS4 have this error.

Yep, any target with strict alignment requirements should be
presenting this kind of error for code such as

#include <stdlib.h>
main() {
    char c[5];
    memset(c, 0, sizeof(c));
}

The problem is a side-effect of:

Thu Feb 11 00:08:17 1999  John Wehle  (john@feith.com)

	* function.c (assign_stack_temp_for_type): Clear best_p
	when an exact match is found.

	* i386.h (LOCAL_ALIGNMENT): Define.
	* function.c (assign_stack_local, assign_outer_stack_local): Use it.
	(assign_stack_temp_for_type): New function based on assign_stack_temp.
	(assign_stack_temp): Call it.
	(assign_temp): Use assign_stack_temp_for_type, not assign_stack_temp.
	* stmt.c: Use assign_temp, not assign_stack_temp.
	* tm.texi: Document LOCAL_ALIGNMENT.

It causes the array c to be unaligned.  This wouldn't be a problem if
the inlined version of memset() didn't assume that its argument is
properly aligned in this case.  This patch is probably also causing
slow-downs on other targets that do not reject unaligned data, just
run slower.

Reverting the patch is an obvious temporary fix, since it causes
assign_stack_temp[_for_type] to call assign_stack_local with
align==-1, so that size is rounded up and becomes properly aligned for 
sparc, but it would defeat the purpose of the patch.  So we should
probably fix the code that inlines memset() et al. so as to properly
handle such misalignments.

For your convenience, here's the relevant part of John Wehle's patch,
that should be reverted in order to bootstrap on sparc targets.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil

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

* Re: egcs-2.93.08 19990215 sparc-sun-solaris2.5 bootstrap fails (genrecog)
  1999-02-16 21:33 ` egcs-2.93.08 19990215 sparc-sun-solaris2.5 bootstrap fails (genrecog) Alexandre Oliva
@ 1999-02-28 22:53   ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 1999-02-28 22:53 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs-bugs, egcs

On Feb 16, 1999, "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> wrote:

> 	I am getting bootstrap failures on sparc's for egcs-2.93.08
> 19990215.  I initially reported an identical problem on SunOS4 with
> --enable-c-cpplib, however it occurs even with no special options.  I.e. 
> its not specific to cpplib.  Both solaris and SunOS4 have this error.

Yep, any target with strict alignment requirements should be
presenting this kind of error for code such as

#include <stdlib.h>
main() {
    char c[5];
    memset(c, 0, sizeof(c));
}

The problem is a side-effect of:

Thu Feb 11 00:08:17 1999  John Wehle  (john@feith.com)

	* function.c (assign_stack_temp_for_type): Clear best_p
	when an exact match is found.

	* i386.h (LOCAL_ALIGNMENT): Define.
	* function.c (assign_stack_local, assign_outer_stack_local): Use it.
	(assign_stack_temp_for_type): New function based on assign_stack_temp.
	(assign_stack_temp): Call it.
	(assign_temp): Use assign_stack_temp_for_type, not assign_stack_temp.
	* stmt.c: Use assign_temp, not assign_stack_temp.
	* tm.texi: Document LOCAL_ALIGNMENT.

It causes the array c to be unaligned.  This wouldn't be a problem if
the inlined version of memset() didn't assume that its argument is
properly aligned in this case.  This patch is probably also causing
slow-downs on other targets that do not reject unaligned data, just
run slower.

Reverting the patch is an obvious temporary fix, since it causes
assign_stack_temp[_for_type] to call assign_stack_local with
align==-1, so that size is rounded up and becomes properly aligned for 
sparc, but it would defeat the purpose of the patch.  So we should
probably fix the code that inlines memset() et al. so as to properly
handle such misalignments.

For your convenience, here's the relevant part of John Wehle's patch,
that should be reverted in order to bootstrap on sparc targets.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil

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

end of thread, other threads:[~1999-02-28 22:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199902160235.VAA22211@caip.rutgers.edu>
1999-02-16 21:33 ` egcs-2.93.08 19990215 sparc-sun-solaris2.5 bootstrap fails (genrecog) Alexandre Oliva
1999-02-28 22:53   ` Alexandre Oliva

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