This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: 8/16bit oddities on avr-gcc


Hi again,

Andrew Haley schrieb:
For -O2 gcc 4.3 does:

;; Function test (test)

Analyzing Edge Insertions.
test ()
{
  uint8_t ctr;

<bb 2>:
  xx = 0;
  xx = 1;
  ctr = 2;

<L0>:;
  xx = ctr;
  ctr = ctr + 1;
  if (ctr != 64) goto <L0>; else goto <L1>;

<L1>:;
  return;

okay, i just tested 4.2-20070228 and voila - i can reproduce what you have seen in 4.3, here is the assembler equivalent of this:


test:
/* prologue: frame size=0 */
/* prologue end (size=0) */
        sts var,__zero_reg__
        ldi r24,lo8(1)
        sts var,r24
        ldi r24,lo8(2)
.L2:
        sts var,r24
        subi r24,lo8(-(1))
        cpi r24,lo8(64)
        brne .L2
/* epilogue: frame size=0 */
        ret

So the uint8_t versus unsigned int problem seems to be gone in 4.2. But only for this special case, as in the function where i have seen the "problem" yesterday, i see this "unsigned int" stuff again now and it again compiles to a 16 bit counter. I'll try to find out what triggers the problem this time.

...Michael


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