On a 64 bit machine, executing

$ make check RUNTESTFLAGS="avr-torture.exp=builtins-1.c 
--target_board=atxmega128a1"

causes virtual memory allocation failure and/or large scale machine
slowdown, with cc1 using up gobs (>35G) virtual memory.

I tracked this down to

void delay_4 (void)  { __builtin_avr_delay_cycles (-1ul); }

In avr_expand_delay_cycles, the operand is converted into a
HOST_WIDE_UINT, which on a 64 bit machine is 0xFFFFFFFFFFFFFFFF. The
range checks therefore get bypassed and the while(cycles >= 2) loop near
the end keeps generating nops, exhausting memory.

Given that avr_init_builtins declares delay_cycles builtin to take
take an unsigned long (which I guess is 4 bytes for the AVR target),
should the code be changed to consider only the lower 4 bytes? Or did I
do something wrong?

Regards
Senthil




Reply via email to