utils2.c (maybe_wrap_malloc): Fix crash when allocating very large object on VMS.
authorTristan Gingold <gingold@adacore.com>
Mon, 11 Oct 2010 09:49:37 +0000 (09:49 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 11 Oct 2010 09:49:37 +0000 (11:49 +0200)
2010-10-11  Tristan Gingold  <gingold@adacore.com>

* gcc-interface/utils2.c (maybe_wrap_malloc): Fix crash when allocating
very large object on VMS.

From-SVN: r165288

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils2.c

index cb8db41b688d459455d43dd701d6e3610eb4d92a..2915c1ae6ea2cf5386872998e0e5c0844de9a6e4 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-11  Tristan Gingold  <gingold@adacore.com>
+
+       * gcc-interface/utils2.c (maybe_wrap_malloc): Fix crash when allocating
+       very large object on VMS.
+
 2010-10-11  Javier Miranda  <miranda@adacore.com>
 
        * sem_ch10.adb (Analyze_With_Clause): Add missing test to ensure
index 8419170cdbb13f73f41e9c9a1974fe66cbf07b87..62380deab9826927974e16ddcca216fd2d6320f9 100644 (file)
@@ -1820,9 +1820,10 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node)
   /* On VMS, if pointers are 64-bit and the allocator size is 32-bit or
      Convention C, allocate 32-bit memory.  */
   if (TARGET_ABI_OPEN_VMS
-      && (POINTER_SIZE == 64
-            && (UI_To_Int (Esize (Etype (gnat_node))) == 32
-                || Convention (Etype (gnat_node)) == Convention_C)))
+      && POINTER_SIZE == 64
+      && Nkind (gnat_node) == N_Allocator
+      && (UI_To_Int (Esize (Etype (gnat_node))) == 32
+          || Convention (Etype (gnat_node)) == Convention_C))
     malloc_ptr = build_call_1_expr (malloc32_decl, size_to_malloc);
   else
     malloc_ptr = build_call_1_expr (malloc_decl, size_to_malloc);