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

Re: egcs-1.0.1/m68k-coff bug


Hans Zuidam <hans@brandinnovators.com> writes:

|> I think I've found a bug in egcs-1.0.1 for m68k-coff.  In the
|> following program the variable pnum is stored in register %a0 which
|> is some statements further down clobbered.  Below is an example
|> program which shows the causes the problem, followed by snippets
|> of machine code.

There is no bug here.

|> 44:yyy.c         ****     pnum = ntohl(*(u_long *) &(pkt_cmd_in[ 6]));
|>   57                    .stabn 68,0,44,.LM7-pkt_watchdog_status
|>   58                    .LM7:
|>   59 0018 2079 0000             move.l pkt_cmd_in+6,%a0
|>                                 ^^^^^^^^^^^^^^^^^^^^^^^
|> Here pnum is assigned to %a0

|>   64:yyy.c         ****     if (port[pnum].p_nwd == 0) {
|>   90                    .stabn 68,0,64,.LM16-pkt_watchdog_status
|>   91                    .LM16:
|>   92 0054 41F0 8E00             lea (%a0,%a0.l*8),%a0
|>   93 0058 2008                  move.l %a0,%d0
|>   94 005a 41F9 0000             lea port,%a0
|>   94      0000 
|>                                 ^^^^^^^^^^^^
|> Here %a0 (i.e. pnum) gets clobbered

Which is correct because pnum is dead.  Note that the body of the
following loop that uses pnum becomes completely empty.  There is nothing
that depends on its outcome.  I guess that you forgot to increment nwd.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org


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