Patchwork [asan] Another ICE fix

login
register
mail settings
Submitter Jakub Jelinek
Date Nov. 27, 2012, 6:46 p.m.
Message ID <20121127184630.GF2315@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/202281/
State New
Headers show

Comments

Jakub Jelinek - Nov. 27, 2012, 6:46 p.m.
Hi!

E.g. on c_char_tests.f03 we have a stmt like
  _2 = VIEW_CONVERT_EXPR<character(kind=1)[1:1]>(121)[1]{lb: 1 sz: 1};
after inlining (wonder why we never fold that to 121), which asan
incorrectly considered to be a load and thus attempted to instrument it,
by taking address of the rhs.

Fixed thusly, ok for trunk?

2012-11-27  Jakub Jelinek  <jakub@redhat.com>

	* asan.c (instrument_assignment): Instrument lhs only
	for gimple_store_p and rhs1 only for gimple_assign_load_p.


	Jakub
Dodji Seketeli - Dec. 3, 2012, 1:49 p.m.
Jakub Jelinek <jakub@redhat.com> writes:

> Fixed thusly, ok for trunk?
>
> 2012-11-27  Jakub Jelinek  <jakub@redhat.com>
>
> 	* asan.c (instrument_assignment): Instrument lhs only
> 	for gimple_store_p and rhs1 only for gimple_assign_load_p.

This is OK, thanks.

And sorry for the delay.

Patch

--- gcc/asan.c.jj	2012-11-27 17:37:10.000000000 +0100
+++ gcc/asan.c	2012-11-27 18:37:21.316247456 +0100
@@ -1358,10 +1358,12 @@  instrument_assignment (gimple_stmt_itera
 
   gcc_assert (gimple_assign_single_p (s));
 
-  instrument_derefs (iter, gimple_assign_lhs (s),
-		     gimple_location (s), true);
-  instrument_derefs (iter, gimple_assign_rhs1 (s),
-		     gimple_location (s), false);
+  if (gimple_store_p (s))
+    instrument_derefs (iter, gimple_assign_lhs (s),
+		       gimple_location (s), true);
+  if (gimple_assign_load_p (s))
+    instrument_derefs (iter, gimple_assign_rhs1 (s),
+		       gimple_location (s), false);
 }
 
 /* Instrument the function call pointed to by the iterator ITER, if it