diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c032c98142aabe90adea5a7ecd50ccf7f09d4d6f..2b626a34272f74ec19dddcf8039a67a30538c0f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-19  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+	* config/s390/s390.c (override_options): Added check for -mstack-size
+	64k limitation.
+	* doc/invoke.texi: Mention that limit in the documenation.
+
 2005-10-18  Paolo Bonzini  <bonzini@gnu.org>
 
 	PR #19672
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 5284db160df0cd8b8fed5c6abf056230f4705dde..7c0d9847a5f5e4e9ba981152b61c04f16e150b07 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -1385,6 +1385,8 @@ override_options (void)
 	error ("-mstack-size implies use of -mstack-guard");
       else if (s390_stack_guard >= s390_stack_size)
 	error ("stack size must be greater than the stack guard value");
+      else if (s390_stack_size > 1 << 16)
+	error ("stack size must not be greater than 64k");
     }
   else if (s390_stack_guard)
     error ("-mstack-guard implies use of -mstack-size"); 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4d8e67aaa53bed97b007f5c90160a1fed2faad01..8bbbb04dfb3a996b896ffa297d336b21fd1c5736 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -11659,9 +11659,10 @@ back end emits additional instructions in the function prologue which trigger a
 if the stack size is @var{stack-guard} bytes above the @var{stack-size}
 (remember that the stack on s390 grows downward).  These options are intended to
 be used to help debugging stack overflow problems.  The additionally emitted code
-cause only little overhead and hence can also be used in production like systems
+causes only little overhead and hence can also be used in production like systems
 without greater performance degradation.  The given values have to be exact
-powers of 2 and @var{stack-size} has to be greater than @var{stack-guard}.
+powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without
+exceeding 64k.
 In order to be efficient the extra code makes the assumption that the stack starts
 at an address aligned to the value given by @var{stack-size}.
 @end table