summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-17 18:08:05 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-17 18:08:05 +0000
commit49c0e9db11d373d5fbebda75bb97195a79c3221a (patch)
treea116d1b19f474b35987ce4e962e78b89ef101e20
parent571704e8bb252ccf2ad0464facc1fc09652ae4d6 (diff)
downloadgcc-49c0e9db11d373d5fbebda75bb97195a79c3221a.tar.gz
PR fortran/45308
* intrinsics/date_and_time.c (date_and_time): Pass __{zone,time,date}_len instead of {ZONE,TIME,DATE}_LEN as second argument to fstrcpy. Drop asserts. Adjust comment to the F2003 wording from the F95 wording. * gfortran.dg/pr45308.f03: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163312 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr45308.f039
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/intrinsics/date_and_time.c57
4 files changed, 43 insertions, 35 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a4c99b89d5b..60c856d4ec0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/45308
+ * gfortran.dg/pr45308.f03: New test.
+
2010-08-17 Uros Bizjak <ubizjak@gmail.com>
PR target/45296
diff --git a/gcc/testsuite/gfortran.dg/pr45308.f03 b/gcc/testsuite/gfortran.dg/pr45308.f03
new file mode 100644
index 00000000000..ba96104b02c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr45308.f03
@@ -0,0 +1,9 @@
+! PR fortran/45308
+! { dg-do run }
+ character(len=36) :: date, time
+ date = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ time = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ call date_and_time (date, time)
+ if (index (date, 'a') /= 0 .or. index (time, 'a') /= 0) &
+ call abort
+end
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 9f767975ac3..b0a9c05ceb6 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/45308
+ * intrinsics/date_and_time.c (date_and_time): Pass __{zone,time,date}_len
+ instead of {ZONE,TIME,DATE}_LEN as second argument to fstrcpy. Drop
+ asserts. Adjust comment to the F2003 wording from the F95 wording.
+
2010-08-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/44931
diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c
index 21e4320e134..2ee8e5c0af7 100644
--- a/libgfortran/intrinsics/date_and_time.c
+++ b/libgfortran/intrinsics/date_and_time.c
@@ -93,29 +93,25 @@ gmtime_r (const time_t * timep, struct tm * result)
Arguments:
- DATE (optional) shall be scalar and of type default character, and
- shall be of length at least 8 in order to contain the complete
- value. It is an INTENT(OUT) argument. Its leftmost 8 characters
- are assigned a value of the form CCYYMMDD, where CC is the century,
- YY the year within the century, MM the month within the year, and
- DD the day within the month. If there is no date available, they
- are assigned blanks.
-
- TIME (optional) shall be scalar and of type default character, and
- shall be of length at least 10 in order to contain the complete
- value. It is an INTENT(OUT) argument. Its leftmost 10 characters
- are assigned a value of the form hhmmss.sss, where hh is the hour
- of the day, mm is the minutes of the hour, and ss.sss is the
- seconds and milliseconds of the minute. If there is no clock
- available, they are assigned blanks.
-
- ZONE (optional) shall be scalar and of type default character, and
- shall be of length at least 5 in order to contain the complete
- value. It is an INTENT(OUT) argument. Its leftmost 5 characters
- are assigned a value of the form [+-]hhmm, where hh and mm are the
- time difference with respect to Coordinated Universal Time (UTC) in
- hours and parts of an hour expressed in minutes, respectively. If
- there is no clock available, they are assigned blanks.
+ DATE (optional) shall be scalar and of type default character.
+ It is an INTENT(OUT) argument. It is assigned a value of the
+ form CCYYMMDD, where CC is the century, YY the year within the
+ century, MM the month within the year, and DD the day within the
+ month. If there is no date available, they are assigned blanks.
+
+ TIME (optional) shall be scalar and of type default character.
+ It is an INTENT(OUT) argument. It is assigned a value of the
+ form hhmmss.sss, where hh is the hour of the day, mm is the
+ minutes of the hour, and ss.sss is the seconds and milliseconds
+ of the minute. If there is no clock available, they are assigned
+ blanks.
+
+ ZONE (optional) shall be scalar and of type default character.
+ It is an INTENT(OUT) argument. It is assigned a value of the
+ form [+-]hhmm, where hh and mm are the time difference with
+ respect to Coordinated Universal Time (UTC) in hours and parts
+ of an hour expressed in minutes, respectively. If there is no
+ clock available, they are assigned blanks.
VALUES (optional) shall be of type default integer and of rank
one. It is an INTENT(OUT) argument. Its size shall be at least
@@ -311,22 +307,13 @@ date_and_time (char *__date, char *__time, char *__zone,
}
if (__zone)
- {
- assert (__zone_len >= ZONE_LEN);
- fstrcpy (__zone, ZONE_LEN, zone, ZONE_LEN);
- }
+ fstrcpy (__zone, __zone_len, zone, ZONE_LEN);
if (__time)
- {
- assert (__time_len >= TIME_LEN);
- fstrcpy (__time, TIME_LEN, timec, TIME_LEN);
- }
+ fstrcpy (__time, __time_len, timec, TIME_LEN);
if (__date)
- {
- assert (__date_len >= DATE_LEN);
- fstrcpy (__date, DATE_LEN, date, DATE_LEN);
- }
+ fstrcpy (__date, __date_len, date, DATE_LEN);
}