[PATCH] Properly honor no_sanitize_undefined attribute

Jakub Jelinek jakub@redhat.com
Mon Jun 30 13:00:00 GMT 2014


On Mon, Jun 30, 2014 at 02:58:53PM +0200, Jakub Jelinek wrote:
> On Mon, Jun 30, 2014 at 02:08:26PM +0200, Marek Polacek wrote:
> > Apparently I didn't pay much attention to no_sanitize_undefined
> > attribute when adding new features to ubsan, so we would instrument
> > stuff even though the function is marked with this attribute.
> > Thus fixed & new testcases added.
> > 
> > Bootstrapped/regtested on x86_64-linux, ok for trunk?
> > 
> > 2014-06-30  Marek Polacek  <polacek@redhat.com>
> > 
> > 	* convert.c (convert_to_integer): Don't instrument conversions if the
> > 	function has no_sanitize_undefined attribute.
> > 	* ubsan.c: Don't run the ubsan pass if the function has
> > 	no_sanitize_undefined attribute.
> > c/
> > 	* c-decl.c (grokdeclarator): Don't instrument VLAs if the function
> > 	has no_sanitize_undefined attribute.
> > cp/
> > 	* cp-gimplify.c (cp_genericize): Don't instrument returns if the
> > 	function has no_sanitize_undefined attribute.
> > 	* decl.c (compute_array_index_type): Don't instrument VLAs if the
> > 	function has no_sanitize_undefined attribute.
> > testsuite/
> > 	* c-c++-common/ubsan/attrib-2.c: New test.
> > 	* g++.dg/ubsan/return-3.C: New test.
> 
> Ok, thanks.

Actually, please change current_function_decl != 0 to
current_function_decl != NULL_TREE everywhere in the patch.
Ok with that change.

	Jakub



More information about the Gcc-patches mailing list