re PR fortran/50004 (ICE in c_ptr_tests_16.f90)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 6 Aug 2011 15:19:45 +0000 (15:19 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 6 Aug 2011 15:19:45 +0000 (15:19 +0000)
2011-08-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/50004
* target-memory.c (gfc_target_expr-size): Don't clobber typespec
for derived types.
* simplify.c (gfc_simplify_transfer): Don't calculate source_size
twice.

From-SVN: r177527

gcc/fortran/ChangeLog
gcc/fortran/simplify.c
gcc/fortran/target-memory.c

index 5567ffd7838af3b2c2530f1f0240a07b5a8b7030..81eec356b502b5254d89d1275c9c7ef6d42c452b 100644 (file)
@@ -1,3 +1,11 @@
+2011-08-06  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/50004
+       * target-memory.c (gfc_target_expr-size): Don't clobber typespec
+       for derived types.
+       * simplify.c (gfc_simplify_transfer): Don't calculate source_size
+       twice.
+
 2011-08-05  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/37211
index e4ffc3b477fd396ab5b9ba536609721036f706c3..13a9c5147c0dd824d040d1624ade486af11454c7 100644 (file)
@@ -6048,8 +6048,6 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
       && gfc_array_size (source, &tmp) == FAILURE)
     gfc_internal_error ("Failure getting length of a constant array.");
 
-  source_size = gfc_target_expr_size (source);
-
   /* Create an empty new expression with the appropriate characteristics.  */
   result = gfc_get_constant_expr (mold->ts.type, mold->ts.kind,
                                  &source->where);
index 025bccf0b0cccc86687a8d06792c4a8ada70307b..63878959b47e39fd4b1e2117eb59d556ce6ec96f 100644 (file)
@@ -120,8 +120,14 @@ gfc_target_expr_size (gfc_expr *e)
     case BT_HOLLERITH:
       return e->representation.length;
     case BT_DERIVED:
-      type = gfc_typenode_for_spec (&e->ts);
-      return int_size_in_bytes (type);
+      {
+       /* Determine type size without clobbering the typespec for ISO C
+          binding types.  */
+       gfc_typespec ts;
+       ts = e->ts;
+       type = gfc_typenode_for_spec (&ts);
+       return int_size_in_bytes (type);
+      }
     default:
       gfc_internal_error ("Invalid expression in gfc_target_expr_size.");
       return 0;