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: segv in memcpy on alpha (3)


On Sat, Oct 23, 1999 at 01:46:01PM +0000, Golubev I. N. wrote:
> Since gcc -O2 translates `memcpy' to bcopy() calls ...

The problem is in gcc's knowledge of what the bcopy prototype is -- it
thinks it's an `int' not a `size_t', further compounded by the fact that
internally generated function calls aren't treated quite like source
level function calls.

The fix is to not transform memcpy to bcopy, which is just silly on
every Alpha OS.


r~

        * alpha.h (TARGET_MEM_FUNCTIONS): Define here.
        * linux.h, netbsd.h, vms.h: Not here.

Index: alpha.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.h,v
retrieving revision 1.80
diff -c -p -d -r1.80 alpha.h
*** alpha.h	1999/10/15 05:52:38	1.80
--- alpha.h	1999/10/26 20:30:19
*************** do {							\
*** 2505,2507 ****
--- 2505,2510 ----
  
  /* The system headers under Alpha systems are generally C++-aware.  */
  #define NO_IMPLICIT_EXTERN_C
+ 
+ /* Generate calls to memcpy, etc., not bcopy, etc. */
+ #define TARGET_MEM_FUNCTIONS 1
Index: linux.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/linux.h,v
retrieving revision 1.16
diff -c -p -d -r1.16 linux.h
*** linux.h	1999/01/11 13:33:54	1.16
--- linux.h	1999/10/26 20:30:19
*************** SUB_CPP_PREDEFINES
*** 31,39 ****
  #undef LIB_SPEC
  #define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}"
  
- /* Generate calls to memcpy, etc., not bcopy, etc. */
- #define TARGET_MEM_FUNCTIONS 1
- 
  #undef FUNCTION_PROFILER
  #define FUNCTION_PROFILER(FILE, LABELNO)			\
  	fputs ("\tlda $28,_mcount\n\tjsr $28,($28),_mcount\n", (FILE))
--- 31,36 ----
Index: netbsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/netbsd.h,v
retrieving revision 1.4
diff -c -p -d -r1.4 netbsd.h
*** netbsd.h	1999/01/11 13:33:57	1.4
--- netbsd.h	1999/10/26 20:30:19
*************** Boston, MA 02111-1307, USA.  */
*** 28,36 ****
  #undef LIB_SPEC
  #define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}"
  
- /* Generate calls to memcpy, etc., not bcopy, etc. */
- #define TARGET_MEM_FUNCTIONS
- 
  #undef FUNCTION_PROFILER
  #define FUNCTION_PROFILER(FILE, LABELNO)			\
  	fputs ("\tlda $28,_mcount\n\tjsr $28,($28),_mcount\n", (FILE))
--- 28,33 ----
Index: vms.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/vms.h,v
retrieving revision 1.23
diff -c -p -d -r1.23 vms.h
*** vms.h	1999/09/07 05:48:21	1.23
--- vms.h	1999/10/26 20:30:19
*************** Boston, MA 02111-1307, USA.  */
*** 61,69 ****
  #define PTRDIFF_TYPE	"int"
  */
  
- /* Use memcpy for structure copying, and so forth.  */
- #define TARGET_MEM_FUNCTIONS
- 
  /* By default, allow $ to be part of an identifier.  */
  #define DOLLARS_IN_IDENTIFIERS 2
  
--- 61,66 ----


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