This is the mail archive of the 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]

[asan] Another ICE fix


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  <>

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

--- 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


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