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: h8300: less optimal (buggy?) compiler output with last build



----- Original Message -----
From: Bill Knight <BillK@rosw.com>
To: gcc <gcc@gcc.gnu.org>; gnuh8 <gnuh8@pcserv.demon.co.uk>
Sent: Wednesday, August 16, 2000 6:01 PM
Subject: Re: h8300: less optimal (buggy?) compiler output with last build


> The compiler may be trying to "help" because of the implied
> int declaration of Watchdog().  You might try the following
> declaration for Watchdog() and recheck the results:
>
> inline void Watchdog(void)
> {
>   TCW = 0;
> }
>

One more typo in the rendering. My sources were correct, though...

To sum it up:
The compiler generates an unneccessary (and thus erroneous, even dangerous)
read acccess to a previously written location, if all of the following
conditions are true:

1) the object is volatile
2) the object is written to by an inline function
3) this inline function is called

example source (hopefully without typos ;-)

///////////////////////////////////////
extern volatile unsigned char TCW;

extern inline void WD(void)
{
  TCW = 0;
}

void test(void)
{
  WD();
}
///////////////////////////////////////

> >
> >Is this issue present in other ports?

This question has been answered already: yes!

> >Will this be investigated by somebody?
> >Or, could anybody give hints where to look for this issue in the sources?

These questions are still to be answered :-(

Regards,
Ralf


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