C++ new and aliasing

John Carr jfc@mit.edu
Sat Apr 25 16:18:00 GMT 1998


This patch fixes a bug in the code which tests whether a call is to
a malloc-like function.  (The alias code knows that the return value
of malloc does not alias any other memory.)


Sat Apr 25 16:38:46 1998  John Carr  <jfc@mit.edu>

	* calls.c (expand_call): Fix code to recognize C++ operator new.

*** calls.c	1998/04/09 00:44:41	1.19
--- calls.c	1998/04/25 20:40:57
*************** expand_call (exp, target, ignore)
*** 901,908 ****
        else if (! strcmp (tname, "malloc")
  	       || ! strcmp (tname, "calloc")
  	       || ! strcmp (tname, "realloc")
! 	       || ! strcmp (tname, "__builtin_new")
! 	       || ! strcmp (tname, "__builtin_vec_new"))
  	is_malloc = 1;
      }
  
--- 901,912 ----
        else if (! strcmp (tname, "malloc")
  	       || ! strcmp (tname, "calloc")
  	       || ! strcmp (tname, "realloc")
! 	       /* Note use of NAME rather than TNAME here.  These functions
! 		  are only reserved when preceded with __.  */
! 	       || ! strcmp (name, "__vn")	/* mangled __builtin_vec_new */
! 	       || ! strcmp (name, "__nw")	/* mangled __builtin_new */
! 	       || ! strcmp (name, "__builtin_new")
! 	       || ! strcmp (name, "__builtin_vec_new"))
  	is_malloc = 1;
      }
  



More information about the Gcc mailing list