This is the mail archive of the gcc-bugs@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]

Bad code generation with -O2 (ARM7 architecture)


I have found an instance of bad code generation. It happens in function
with complex control flow and lots of gotos.
I have isolated the bad code and produced debug output.
The fragment produces this output:

/* First, check if the sequence number of the incoming packet is
     what we're expecting next. If not, we send out an ACK with the
     correct numbers in. */

     printf("seq nos %d %d %d
%d\n",BUF->seqno[0],BUF->seqno[1],BUF->seqno[2],BUF->seqno[3]);
     printf("rcv_next %d %d %d
%d\n",uip_connr->rcv_nxt[0],uip_connr->rcv_nxt[1],uip_connr->rcv_nxt[2],uip_
connr->rcv_nxt[3]);

  if(uip_len > 0 &&
     ((BUF->seqno[0] != uip_connr->rcv_nxt[0]) ||
      (BUF->seqno[1] != uip_connr->rcv_nxt[1]) ||
      (BUF->seqno[2] != uip_connr->rcv_nxt[2]) ||
      (BUF->seqno[3] != uip_connr->rcv_nxt[3])))
{
      UIP_LOG("BUG1 comparison failed");
	goto send_ack;
}

seq nos 139 174 46 67
rcv_next 139 174 46 67
uIP log message: BUG1 comparison failed

When I make simple test of the comparison the generated code is OK.
When this comparison is part of complex function the generated code
is incorrect. Compiling with -O0 generates good code.

I would like your advise what to do next for debugging this code.




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