summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-14 05:17:41 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-14 05:17:41 +0000
commit4f61e50d1cb81f3caced1e4cfe6ae22327a93925 (patch)
treef88d3a397949e313a970b9ac73ff0020ab38fcda /libgfortran
parentf213a307a1e54b1a4a61904f697c605085fd4c84 (diff)
downloadgcc-4f61e50d1cb81f3caced1e4cfe6ae22327a93925.tar.gz
2009-09-14 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 151679 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@151680 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog16
-rw-r--r--libgfortran/Makefile.am1
-rw-r--r--libgfortran/Makefile.in4
-rw-r--r--libgfortran/io/transfer.c25
-rw-r--r--libgfortran/io/write.c2
5 files changed, 34 insertions, 14 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index f46f11a861e..346981415f1 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,19 @@
+2009-09-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/41328
+ * io/transfer.c (read_sf): Adjust fbuf position and do proper
+ fbuf reads to traverse CR, CR-LF, and LF style line ends.
+
+2009-09-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/41219
+ * io/write.c (write_a_char4): Use correct type for crlf constant.
+
+2009-09-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.am (libgfortranbegin_la_LINK): New.
+ * Makefile.in: Regenerate.
+
2009-09-09 Paolo Bonzini <bonzini@gnu.org>
* configure: Regenerate.
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 08609557ce6..c2fd941a992 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -24,6 +24,7 @@ myexeclib_LTLIBRARIES = libgfortranbegin.la
myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
libgfortranbegin_la_SOURCES = fmain.c
libgfortranbegin_la_LDFLAGS = -static
+libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS)
## io.h conflicts with a system header on some platforms, so
## use -iquote
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 1bcae42d52d..462b07b487b 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -777,9 +777,6 @@ libgfortran_la_OBJECTS = $(am_libgfortran_la_OBJECTS)
libgfortranbegin_la_LIBADD =
am_libgfortranbegin_la_OBJECTS = fmain.lo
libgfortranbegin_la_OBJECTS = $(am_libgfortranbegin_la_OBJECTS)
-libgfortranbegin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libgfortranbegin_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/../depcomp
am__depfiles_maybe = depfiles
@@ -984,6 +981,7 @@ myexeclib_LTLIBRARIES = libgfortranbegin.la
myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
libgfortranbegin_la_SOURCES = fmain.c
libgfortranbegin_la_LDFLAGS = -static
+libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS)
AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config \
-I$(MULTIBUILDTOP)../../$(host_subdir)/gcc -D_GNU_SOURCE
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 59f88d4fb9b..2362a154592 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -232,21 +232,28 @@ read_sf (st_parameter_dt *dtp, int * length, int no_error)
if (q == '\n' || q == '\r')
{
- /* Unexpected end of line. */
+ /* Unexpected end of line. Set the position. */
+ fbuf_seek (dtp->u.p.current_unit, n + 1 ,SEEK_CUR);
+ dtp->u.p.sf_seen_eor = 1;
/* If we see an EOR during non-advancing I/O, we need to skip
the rest of the I/O statement. Set the corresponding flag. */
if (dtp->u.p.advance_status == ADVANCE_NO || dtp->u.p.seen_dollar)
dtp->u.p.eor_condition = 1;
-
+
/* If we encounter a CR, it might be a CRLF. */
if (q == '\r') /* Probably a CRLF */
{
- if (n < *length && *(p + 1) == '\n')
- dtp->u.p.sf_seen_eor = 2;
+ /* See if there is an LF. Use fbuf_read rather then fbuf_getc so
+ the position is not advanced unless it really is an LF. */
+ int readlen = 1;
+ p = fbuf_read (dtp->u.p.current_unit, &readlen);
+ if (*p == '\n' && readlen == 1)
+ {
+ dtp->u.p.sf_seen_eor = 2;
+ fbuf_seek (dtp->u.p.current_unit, 1 ,SEEK_CUR);
+ }
}
- else
- dtp->u.p.sf_seen_eor = 1;
/* Without padding, terminate the I/O statement without assigning
the value. With padding, the value still needs to be assigned,
@@ -260,7 +267,7 @@ read_sf (st_parameter_dt *dtp, int * length, int no_error)
}
*length = n;
- break;
+ goto done;
}
/* Short circuit the read if a comma is found during numeric input.
The flag is set to zero during character reads so that commas in
@@ -274,13 +281,11 @@ read_sf (st_parameter_dt *dtp, int * length, int no_error)
*length = n;
break;
}
-
n++;
p++;
}
- fbuf_seek (dtp->u.p.current_unit, n + dtp->u.p.sf_seen_eor + seen_comma,
- SEEK_CUR);
+ fbuf_seek (dtp->u.p.current_unit, n + seen_comma, SEEK_CUR);
/* A short read implies we hit EOF, unless we hit EOR, a comma, or
some other stuff. Set the relevant flags. */
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 4956da8cf80..3c16a43b9ab 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -293,7 +293,7 @@ write_a_char4 (st_parameter_dt *dtp, const fnode *f, const char *source, int len
Standard sections 10.6.3 and 9.9 for further information. */
if (is_stream_io (dtp))
{
- const char crlf[] = "\r\n";
+ const gfc_char4_t crlf[] = {0x000d,0x000a};
int i, bytes;
gfc_char4_t *qq;
bytes = 0;