aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/backspace.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2005-04-08 19:07:54 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2005-04-08 19:07:54 +0000
commit01d87b6f3da40f38bfda6a538316fb8e6ce9a888 (patch)
tree207b3f4ff97af1de18c70f425cd92d3da3856266 /libgfortran/io/backspace.c
parent9ff7d88e0faf1b0a18fd0eca66cb93e4a0c8a51b (diff)
downloadgcc-01d87b6f3da40f38bfda6a538316fb8e6ce9a888.zip
gcc-01d87b6f3da40f38bfda6a538316fb8e6ce9a888.tar.gz
gcc-01d87b6f3da40f38bfda6a538316fb8e6ce9a888.tar.bz2
backspace.c (unformatted_backspace): Do not dereference the pointer to the stream.
* io/backspace.c (unformatted_backspace): Do not dereference the pointer to the stream. From-SVN: r97851
Diffstat (limited to 'libgfortran/io/backspace.c')
-rw-r--r--libgfortran/io/backspace.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libgfortran/io/backspace.c b/libgfortran/io/backspace.c
index 225f69c..d4ba3a9 100644
--- a/libgfortran/io/backspace.c
+++ b/libgfortran/io/backspace.c
@@ -28,6 +28,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
+#include <string.h>
#include "libgfortran.h"
#include "io.h"
@@ -101,17 +102,19 @@ formatted_backspace (void)
static void
unformatted_backspace (void)
{
- gfc_offset *p, new;
+ gfc_offset m, new;
int length;
+ char *p;
length = sizeof (gfc_offset);
- p = (gfc_offset *) salloc_r_at (current_unit->s, &length,
- file_position (current_unit->s) - length);
+ p = salloc_r_at (current_unit->s, &length,
+ file_position (current_unit->s) - length);
if (p == NULL)
goto io_error;
- new = file_position (current_unit->s) - *p - 2*length;
+ memcpy (&m, p, sizeof (gfc_offset));
+ new = file_position (current_unit->s) - m - 2*length;
if (sseek (current_unit->s, new) == FAILURE)
goto io_error;