Blob Blame History Raw
commit a999ae2c722b366b94987941f0ce899f95e8d679
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Mar 2 22:08:49 2012 +0100

    Fix crash for gdb.fortran/dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64.

--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1037,7 +1037,8 @@ int
 value_fetch_lazy (struct value *val)
 {
   gdb_assert (value_lazy (val));
-  allocate_value_contents (val);
+  if (VALUE_LVAL (val) != lval_memory)
+    allocate_value_contents (val);
   if (value_bitsize (val))
     {
       /* To read a lazy bitfield, read the entire enclosing value.  This
@@ -1080,11 +1081,15 @@ value_fetch_lazy (struct value *val)
 
 	  if (length)
 	    {
+	      /* Delay it after object_address_get_data above.  */
+	      allocate_value_contents (val);
 	      addr += value_offset (val);
 	      read_value_memory (val, 0, value_stack (val),
 				 addr, value_contents_all_raw (val), length);
 	    }
 	}
+      /* Just to be sure it has been called.  */
+      allocate_value_contents (val);
     }
   else if (VALUE_LVAL (val) == lval_register)
     {