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]
Other format: [Raw text]

[fortran,committed] Don't check for NULL pointers before calling free()


The attached patch changes the gfc_call_free() function to simply call __builtin_free() without first checking if the pointer is NULL, because free(NULL) is a nop. This simplifies code, but could lead to pessimization in cases where the pointer is likely to be NULL, and the test would have saved the function call. After auditing all the gfc_call_free() callers in the front-end, I come to the conclusion that there are no such cases (in fact, in most cases, the front-end knows for sure that the pointer is non-NULL, because it was just allocated some lines earlier).

Committed as rev. 227336 after bootstrap and regtesting on x86_64-apple-darwin15.

FX


Attachment: free.ChangeLog
Description: Binary data

Attachment: free.diff
Description: Binary data


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