]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Better error message for malloc() failure
authorJanne Blomqvist <jb@gcc.gnu.org>
Wed, 15 Dec 2010 17:42:09 +0000 (19:42 +0200)
committerJanne Blomqvist <jb@gcc.gnu.org>
Wed, 15 Dec 2010 17:42:09 +0000 (19:42 +0200)
From-SVN: r167863

gcc/fortran/ChangeLog
gcc/fortran/misc.c
gcc/fortran/trans.c

index 751bd5aee7c9b156a37c0228f26b8111a2de9134..afab6870a3f2aaf8bf39a5c5a92e85edfaaf1ed9 100644 (file)
@@ -1,3 +1,10 @@
+2010-12-15  Janne Blomqvist  <jb@gcc.gnu.org>
+
+       * trans.c (gfc_allocate_with_status): Better error message for
+       malloc() failure.
+       (gfc_call_realloc): Likewise.
+       * misc.c (gfc_getmem): Likewise.
+
 2010-12-15  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR fortran/28105
index 397c87291126d257030cf1dc07fb7283a90bf710..86e102edc529da6f1a7491344fc279445f0f3fe7 100644 (file)
@@ -36,7 +36,7 @@ gfc_getmem (size_t n)
 
   p = xmalloc (n);
   if (p == NULL)
-    gfc_fatal_error ("Out of memory-- malloc() failed");
+    gfc_fatal_error ("Allocation would exceed memory limit -- malloc() failed");
   memset (p, 0, n);
   return p;
 }
index f3914a1020970f7dffda3668ce5bf8b5128cdbcb..1fd0dc130132b7881759804126c88e74bae00db7 100644 (file)
@@ -590,7 +590,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
         if (stat)
           *stat = LIBERROR_ALLOCATION;
         else
-         runtime_error ("Out of memory");
+         runtime_error ("Allocation would exceed memory limit");
       }
       return newmem;
     }  */
@@ -636,7 +636,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
                                                           1)))));
 
   msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
-                                               ("Out of memory"));
+                            ("Allocation would exceed memory limit"));
   tmp = build_call_expr_loc (input_location,
                         gfor_fndecl_os_error, 1, msg);
 
@@ -1003,7 +1003,7 @@ internal_realloc (void *mem, size_t size)
 {
   res = realloc (mem, size);
   if (!res && size != 0)
-    _gfortran_os_error ("Out of memory");
+    _gfortran_os_error ("Allocation would exceed memory limit");
 
   if (size == 0)
     return NULL;
@@ -1036,7 +1036,7 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
   null_result = fold_build2_loc (input_location, TRUTH_AND_EXPR, boolean_type_node,
                                 null_result, nonzero);
   msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
-                                               ("Out of memory"));
+                            ("Allocation would exceed memory limit"));
   tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node,
                         null_result,
                         build_call_expr_loc (input_location,