projects
/
gcc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix use of inaccessible member in pr85503.C [PR95716]
[gcc.git]
/
libgfortran
/
runtime
/
in_unpack_generic.c
diff --git
a/libgfortran/runtime/in_unpack_generic.c
b/libgfortran/runtime/in_unpack_generic.c
index 18855e1b68f19b14e3524dc4114d4ae70327e45a..528af6d1f801013f67858f50811752fd68fdd1bd 100644
(file)
--- a/
libgfortran/runtime/in_unpack_generic.c
+++ b/
libgfortran/runtime/in_unpack_generic.c
@@
-1,5
+1,5
@@
/* Generic helper function for repacking arrays.
/* Generic helper function for repacking arrays.
- Copyright (C) 2003-20
14
Free Software Foundation, Inc.
+ Copyright (C) 2003-20
20
Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran runtime library (libgfortran).
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran runtime library (libgfortran).
@@
-24,8
+24,6
@@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-#include <stdlib.h>
-#include <assert.h>
#include <string.h>
extern void internal_unpack (gfc_array_char *, const void *);
#include <string.h>
extern void internal_unpack (gfc_array_char *, const void *);
@@
-42,8
+40,7
@@
internal_unpack (gfc_array_char * d, const void * s)
index_type dsize;
char *dest;
const char *src;
index_type dsize;
char *dest;
const char *src;
- int n;
- int size;
+ index_type size;
int type_size;
dest = d->base_addr;
int type_size;
dest = d->base_addr;
@@
-56,7
+53,6
@@
internal_unpack (gfc_array_char * d, const void * s)
{
case GFC_DTYPE_INTEGER_1:
case GFC_DTYPE_LOGICAL_1:
{
case GFC_DTYPE_INTEGER_1:
case GFC_DTYPE_LOGICAL_1:
- case GFC_DTYPE_DERIVED_1:
internal_unpack_1 ((gfc_array_i1 *) d, (const GFC_INTEGER_1 *) s);
return;
internal_unpack_1 ((gfc_array_i1 *) d, (const GFC_INTEGER_1 *) s);
return;
@@
-138,7
+134,17
@@
internal_unpack (gfc_array_char * d, const void * s)
# endif
#endif
# endif
#endif
- case GFC_DTYPE_DERIVED_2:
+ default:
+ break;
+ }
+
+ switch (GFC_DESCRIPTOR_SIZE(d))
+ {
+ case 1:
+ internal_unpack_1 ((gfc_array_i1 *) d, (const GFC_INTEGER_1 *) s);
+ return;
+
+ case 2:
if (GFC_UNALIGNED_2(d->base_addr) || GFC_UNALIGNED_2(s))
break;
else
if (GFC_UNALIGNED_2(d->base_addr) || GFC_UNALIGNED_2(s))
break;
else
@@
-146,7
+152,8
@@
internal_unpack (gfc_array_char * d, const void * s)
internal_unpack_2 ((gfc_array_i2 *) d, (const GFC_INTEGER_2 *) s);
return;
}
internal_unpack_2 ((gfc_array_i2 *) d, (const GFC_INTEGER_2 *) s);
return;
}
- case GFC_DTYPE_DERIVED_4:
+
+ case 4:
if (GFC_UNALIGNED_4(d->base_addr) || GFC_UNALIGNED_4(s))
break;
else
if (GFC_UNALIGNED_4(d->base_addr) || GFC_UNALIGNED_4(s))
break;
else
@@
-155,7
+162,7
@@
internal_unpack (gfc_array_char * d, const void * s)
return;
}
return;
}
- case
GFC_DTYPE_DERIVED_
8:
+ case 8:
if (GFC_UNALIGNED_8(d->base_addr) || GFC_UNALIGNED_8(s))
break;
else
if (GFC_UNALIGNED_8(d->base_addr) || GFC_UNALIGNED_8(s))
break;
else
@@
-165,7
+172,7
@@
internal_unpack (gfc_array_char * d, const void * s)
}
#ifdef HAVE_GFC_INTEGER_16
}
#ifdef HAVE_GFC_INTEGER_16
- case
GFC_DTYPE_DERIVED_
16:
+ case 16:
if (GFC_UNALIGNED_16(d->base_addr) || GFC_UNALIGNED_16(s))
break;
else
if (GFC_UNALIGNED_16(d->base_addr) || GFC_UNALIGNED_16(s))
break;
else
@@
-174,7
+181,6
@@
internal_unpack (gfc_array_char * d, const void * s)
return;
}
#endif
return;
}
#endif
-
default:
break;
}
default:
break;
}
@@
-183,7
+189,7
@@
internal_unpack (gfc_array_char * d, const void * s)
dim = GFC_DESCRIPTOR_RANK (d);
dsize = 1;
dim = GFC_DESCRIPTOR_RANK (d);
dsize = 1;
- for (n = 0; n < dim; n++)
+ for (
index_type
n = 0; n < dim; n++)
{
count[n] = 0;
stride[n] = GFC_DESCRIPTOR_STRIDE(d,n);
{
count[n] = 0;
stride[n] = GFC_DESCRIPTOR_STRIDE(d,n);
@@
-216,7
+222,7
@@
internal_unpack (gfc_array_char * d, const void * s)
dest += stride0;
count[0]++;
/* Advance to the next source element. */
dest += stride0;
count[0]++;
/* Advance to the next source element. */
- n = 0;
+
index_type
n = 0;
while (count[n] == extent[n])
{
/* When we get to the end of a dimension, reset it and increment
while (count[n] == extent[n])
{
/* When we get to the end of a dimension, reset it and increment