1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -mtune=xscale" } */
       3  
       4  typedef unsigned int size_t;
       5  typedef short unsigned int __uint16_t;
       6  typedef long unsigned int __uint32_t;
       7  typedef unsigned int __uintptr_t;
       8  typedef __uint16_t uint16_t ;
       9  typedef __uint32_t uint32_t ;
      10  typedef __uintptr_t uintptr_t;
      11  typedef uint32_t Objects_Id;
      12  typedef uint16_t Objects_Maximum;
      13  typedef struct { } Objects_Control;
      14  
      15  static __inline__ void *_Addresses_Align_up (void *address, size_t alignment)
      16  {
      17  	uintptr_t mask = alignment - (uintptr_t)1;
      18  	return (void*)(((uintptr_t)address + mask) & ~mask);
      19  }
      20  
      21  typedef struct {
      22  	Objects_Id minimum_id;
      23  	Objects_Maximum maximum;
      24  	_Bool
      25  		auto_extend;
      26  	Objects_Maximum allocation_size;
      27  	void **object_blocks;
      28  } Objects_Information;
      29  
      30  extern uint32_t _Objects_Get_index (Objects_Id);
      31  extern void** _Workspace_Allocate (size_t);
      32  
      33  void _Objects_Extend_information (Objects_Information *information)
      34  {
      35  	uint32_t block_count;
      36  	uint32_t minimum_index;
      37  	uint32_t maximum;
      38  	size_t block_size;
      39  	_Bool
      40  		do_extend =
      41  		minimum_index = _Objects_Get_index( information->minimum_id );
      42  	if ( information->object_blocks ==
      43  			((void *)0)
      44  	   )
      45  		block_count = 0;
      46  	else {
      47  		block_count = information->maximum / information->allocation_size;
      48  	}
      49  	if ( do_extend ) {
      50  		void **object_blocks;
      51  		uintptr_t object_blocks_size;
      52  		uintptr_t inactive_per_block_size;
      53  		object_blocks_size = (uintptr_t)_Addresses_Align_up(
      54  				(void*)(block_count * sizeof(void*)),
      55  				8
      56  				);
      57  		inactive_per_block_size =
      58  			(uintptr_t)_Addresses_Align_up(
      59  					(void*)(block_count * sizeof(uint32_t)),
      60  					8
      61  					);
      62  		block_size = object_blocks_size + inactive_per_block_size +
      63  			((maximum + minimum_index) * sizeof(Objects_Control *));
      64  		if ( information->auto_extend ) {
      65  			object_blocks = _Workspace_Allocate( block_size );
      66  		} else {
      67  		}
      68  	}
      69  }