This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Ada] [9411-001] Fix array size overflow


Tested and bootstrapped on GNU Linux/x86.

  -Geert

2001-10-30  Richard Kenner <kenner@gnat.com>

	* utils2.c (build_allocator): Test for SIZE overflow in array case too

*** utils2.c	2001/10/20 18:05:36	1.2
--- utils2.c	2001/10/29 20:25:51	1.3
***************
*** 1855,1860 ****
--- 1855,1865 ----
  	  && contains_placeholder_p (size))
  	size = build (WITH_RECORD_EXPR, sizetype, size, init);
  
+       /* If the size overflows, pass -1 so the allocator will raise
+ 	 storage error.  */
+       if (TREE_CODE (size) == INTEGER_CST && TREE_OVERFLOW (size))
+ 	size = ssize_int (-1);
+ 
        storage = build_call_alloc_dealloc (NULL_TREE, size,
  					  TYPE_ALIGN (storage_type),
  					  gnat_proc, gnat_pool);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]