https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79697
prathamesh3492 at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |prathamesh3492 at gcc dot gnu.org --- Comment #4 from prathamesh3492 at gcc dot gnu.org --- Created attachment 40821 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40821&action=edit untested patch In cddce/dce pass, mark_stmt_if_obviously_necessary() does not special case strdup, strndup, and marks them as obviously necessary. From the dump of cddce1: Marking useful stmt: __builtin_strdup ("abc"); The attached (untested) patch does not mark stmt necessary if it's a call stmt and callee is strdup/strndup, and for realloc if the first arg compares equal to null_pointer_node and can thus delete these calls. Does it look OK ? Thanks, Prathamesh