diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dbc0b69f2db579d90777a4a1360ebb5c72e8b944..db4aa5a079850cda5f82df9fce84a6227b859609 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-17  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+	PR fortran/24892
+	* gfortran.dg/open_access_append_1.f90: New test.
+	* gfortran.dg/open_access_append_2.f90: New test.
+
 2005-11-16  Richard Guenther  <rguenther@suse.de>
 
 	PR middle-end/24851
diff --git a/gcc/testsuite/gfortran.dg/open_access_append_1.f90 b/gcc/testsuite/gfortran.dg/open_access_append_1.f90
new file mode 100644
index 0000000000000000000000000000000000000000..7aa7991a75ac05636a9a57c5a9fe7a95efe4d03b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/open_access_append_1.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+! Testcase for the GNU extension OPEN(...,ACCESS="APPEND")
+  open (10,file="foo")
+  close (10,status="delete")
+
+  open (10,file="foo",access="append") ! { dg-output ".*Extension.*" }
+  write (10,*) 42
+  close (10,status="keep")
+  open (10,file="foo",access="append") ! { dg-output ".*Extension.*" }
+  write (10,*) -42
+  close (10,status="keep")
+
+  open (10,file="foo")
+  read (10,*) i
+  if (i /= 42) call abort
+  read (10,*) i
+  if (i /= -42) call abort
+  close (10,status="delete")
+
+  end
diff --git a/gcc/testsuite/gfortran.dg/open_access_append_2.f90 b/gcc/testsuite/gfortran.dg/open_access_append_2.f90
new file mode 100644
index 0000000000000000000000000000000000000000..3661bb0b2f8c76326515452a1b07a5ee723d4d1c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/open_access_append_2.f90
@@ -0,0 +1,5 @@
+! { dg-do run }
+! Testcase for the GNU extension OPEN(...,ACCESS="APPEND")
+  open (10,err=900,access="append",position="asis") ! { dg-output ".*Extension.*" }
+  call abort
+ 900 end
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 29ebfd270ca2692470e019f6c61f68a14c2d2b6c..1fa17337515bb60edd1f3da564df23ab8045a4d9 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-17  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+	PR fortran/24892
+	* io/io.h (unit_access): Add ACCESS_APPEND.
+	* io/open.c (access_opt): Add APPEND value for ACCESS keyword.
+	(st_open): Use that new value to set the POSITION accordingly.
+
 2005-11-14  Janne Blomqvist  <jb@gcc.gnu.org>
 
         PR fortran/21468
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index e26267720e1acd345eaf007953409dce62aefc32..47a564f5e7dbaa4ad44673592ce0b25e28bbde14 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -153,7 +153,7 @@ namelist_info;
 /* Options for the OPEN statement.  */
 
 typedef enum
-{ ACCESS_SEQUENTIAL, ACCESS_DIRECT,
+{ ACCESS_SEQUENTIAL, ACCESS_DIRECT, ACCESS_APPEND,
   ACCESS_UNSPECIFIED
 }
 unit_access;
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 203964b5dea8ac5727c64856610d0b244a2474a9..c3b5dde25ac755ce31f6d77d8f61f442cb90aebb 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -39,6 +39,7 @@ Boston, MA 02110-1301, USA.  */
 static const st_option access_opt[] = {
   {"sequential", ACCESS_SEQUENTIAL},
   {"direct", ACCESS_DIRECT},
+  {"append", ACCESS_APPEND},
   {NULL, 0}
 };
 
@@ -486,6 +487,19 @@ st_open (void)
     generate_error (ERROR_BAD_OPTION,
 		    "Cannot use POSITION with direct access files");
 
+  if (flags.access == ACCESS_APPEND)
+    {
+      if (flags.position != POSITION_UNSPECIFIED
+	  && flags.position != POSITION_APPEND)
+	generate_error (ERROR_BAD_OPTION, "Conflicting ACCESS and POSITION "
+			"flags in OPEN statement");
+	
+      notify_std (GFC_STD_GNU,
+		  "Extension: APPEND as a value for ACCESS in OPEN statement");
+      flags.access = ACCESS_SEQUENTIAL;
+      flags.position = POSITION_APPEND;
+    }
+
   if (flags.position == POSITION_UNSPECIFIED)
     flags.position = POSITION_ASIS;