diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index d9a2d6cd63d..f14cf603bb6 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2009-04-09 Janne Blomqvist + + 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 * m4/cshift0.m4: Change copyright header to refer to version 3 diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 02b14ce4a0f..5ee0979c1e8 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 c19d684b107..23a8fa3019d 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)