[gnu.gcc.bug] gcc 1.31 gets a fatal signal when __builtin_memcpy is used.

moraes@csri.toronto.edu (Mark Moraes) (11/30/88)

The following file and session illustrate the error - gcc gets a SIGIOT.
(Does this mean there isn't a __builtin_memcpy available?)

Gcc compiled and run on a Sun3/180 running SunOS3.5 - used 'config.gcc
sun3'.

% cat memcpy.c
#ifndef BYTES
#define BYTES 10*1024
#endif
#ifndef LOOPS
#define LOOPS 1000
#endif
#ifndef FROMALIGN
#define FROMALIGN 0
#endif
#ifndef TOALIGN
#define TOALIGN 0
#endif

main()          /* time memcpy(3) */
{
        register int count = LOOPS;
        static char from[BYTES], to[BYTES];

        while (count-- > 0)
                memcpy(to, from, sizeof from - FROMALIGN - TOALIGN);
        return 0;
}
% gcc -v -Dmemcpy=__builtin_memcpy memcpy.c
gcc version 1.31
 /local/lib/gcc-cpp -v -Dmemcpy=__builtin_memcpy -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__HAVE_68881__ -Dmc68020 memcpy.c /tmp/cca12899.cpp
GNU CPP version 1.31
 /local/lib/gcc-cc1 /tmp/cca12899.cpp -quiet -dumpbase memcpy.c -version -o /tmp/cca12899.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
gcc: Program cc1 got fatal signal 6.
% 

LOGNAME@xyzzy.UUCP (Michael Meissner) (12/07/88)

At present, GCC does not know about that many builtins, and it does the
usual call to abort if it gets a call to a builtin that it has parsed,
but does not have patterns for.  The following patch to 1.31 (linenumbers
may be different for 1.30) will change the default to just call the library
routine with the same name as the builtin (ie, __builtin_memcpy in this case).


*** ../.orig/expr.c	Wed Dec  7 08:54:10 1988
--- expr.c	Wed Dec  7 09:02:41 1988
***************
*** 2303,2307 ****
  	  && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  	      != NOT_BUILT_IN))
! 	return expand_builtin (exp, target, subtarget, tmode);
        /* If this call was expanded already by preexpand_calls,
  	 just return the result we got.  */
--- 2303,2307 ----
  	  && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  	      != NOT_BUILT_IN))
! 	return expand_builtin (exp, target, subtarget, tmode, ignore);
        /* If this call was expanded already by preexpand_calls,
  	 just return the result we got.  */
***************
*** 3027,3031 ****
  
  static rtx
! expand_builtin (exp, target, subtarget, mode)
       tree exp;
       rtx target;
--- 3027,3031 ----
  
  static rtx
! expand_builtin (exp, target, subtarget, mode, ignore)
       tree exp;
       rtx target;
***************
*** 3032,3035 ****
--- 3032,3036 ----
       rtx subtarget;
       enum machine_mode mode;
+      int ignore;
  {
    tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
***************
*** 3120,3125 ****
        return target;
  
!     default:
!       abort ();
      }
  }
--- 3121,3126 ----
        return target;
  
!     default:			/* just do library call, if unknown builtin */
! 	return expand_call (exp, target, ignore);
      }
  }

--
Michael Meissner, Data General.

Uucp:	...!mcnc!rti!xyzzy!meissner
Arpa:	meissner@dg-rtp.DG.COM   (or) meissner%dg-rtp.DG.COM@relay.cs.net
-- 
Michael Meissner, Data General.

Uucp:	...!mcnc!rti!xyzzy!meissner
Arpa:	meissner@dg-rtp.DG.COM   (or) meissner%dg-rtp.DG.COM@relay.cs.net