aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2009-04-09 20:44:23 +0300
committerJanne Blomqvist <jb@gcc.gnu.org>2009-04-09 20:44:23 +0300
commit60c063faab4ddaec9129430d27524572d4549a24 (patch)
tree0c969a24443ac4004b44a4238a2e03514a8eb292 /libgfortran
parentd5e90cabae9cc024a575908f141db044366ba384 (diff)
downloadgcc-60c063faab4ddaec9129430d27524572d4549a24.zip
gcc-60c063faab4ddaec9129430d27524572d4549a24.tar.gz
gcc-60c063faab4ddaec9129430d27524572d4549a24.tar.bz2
re PR libfortran/39665 (Fortran IO using unaligned accesses to read/write doubles.)
2009-04-09 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/39665 * io/io.h (st_parameter_dt): Add aligned attribute to u.p.value. * io/read.c (convert_real): Add note about alignment requirements. From-SVN: r145852
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/io.h9
-rw-r--r--libgfortran/io/read.c6
3 files changed, 15 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index d9a2d6c..f14cf60 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-09 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/39665
+ * io/io.h (st_parameter_dt): Add aligned attribute to u.p.value.
+ * io/read.c (convert_real): Add note about alignment requirements.
+
2009-04-09 Nick Clifton <nickc@redhat.com>
* m4/cshift0.m4: Change copyright header to refer to version 3
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 02b14ce..5ee0979 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -498,10 +498,11 @@ typedef struct st_parameter_dt
/* A flag used to identify when a non-standard expanded namelist read
has occurred. */
int expanded_read;
- /* Storage area for values except for strings. Must be large
- enough to hold a complex value (two reals) of the largest
- kind. */
- char value[32];
+ /* Storage area for values except for strings. Must be
+ large enough to hold a complex value (two reals) of the
+ largest kind. It must also be sufficiently aligned for
+ assigning any type we use into it. */
+ char value[32] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
GFC_IO_INT size_used;
} p;
/* This pad size must be equal to the pad_size declared in
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index c19d684..23a8fa3 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -126,8 +126,10 @@ max_value (int length, int signed_flag)
/* convert_real()-- Convert a character representation of a floating
* point number to the machine number. Returns nonzero if there is a
- * range problem during conversion. TODO: handle not-a-numbers and
- * infinities. */
+ * range problem during conversion. Note: many architectures
+ * (e.g. IA-64, HP-PA) require that the storage pointed to by the dest
+ * argument is properly aligned for the type in question. TODO:
+ * handle not-a-numbers and infinities. */
int
convert_real (st_parameter_dt *dtp, void *dest, const char *buffer, int length)