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]

Re: [PATCH] Fix -fsanitizer=undefined ICE (PR sanitizer/59258)


On 11/26/13 13:14, Jakub Jelinek wrote:
Hi!

The problem here is that ubsan_create_data was called
with location_t that includes both location and BLOCK, and that
location was sticked into an ADDR_EXPR in a static var's constructor.
As the BLOCk wasn't live in any of the functions, it was removed as unused
and the GCmemory was reused for something different during GC,
but then the BLOCK was rediscovered again from the ADDR_EXPR.

Fixed thusly (in fact either the loc = LOCATION_LOCUS (loc); line
or build_fold_addr_expr line should fix this).  IMHO we want both
changes, because we compare in ubsan_create_data loc to UNKNOWN_LOCATION,
which without LOCATION_LOCUS doesn't work reliably (that is why I've earlier
added the xloc.file == NULL handling which isn't needed anymore),
and setting locus of ADDR_EXPR in a static var's constructor doesn't
really make any sense.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

The testcase was huge and GC dependent, so it wasn't really reducible.

2013-11-25  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/59258
	* ubsan.c (ubsan_source_location): Don't add any location
	to ADDR_EXPR in the ctor.  Revert 2013-11-22 change.
	(ubsan_create_data): Strip block info from LOC.
OK.
jeff


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