Patch to detect invalid and missing ATTRIBUTE const/pure [take 2]

Jan Hubicka jh@suse.cz
Tue Mar 26 06:20:00 GMT 2002


> On Mon, Mar 25, 2002 at 01:07:49PM -0800, Richard Henderson wrote:
> > On Mon, Mar 25, 2002 at 01:02:51PM -0800, Zack Weinberg wrote:
> > > However, for safety's sake, it is starting to sound like we need
> > > another attribute which indicates a const/pure function that does
> > > not necessarily return...
> > 
> > No, please.  Let's just loosen the definition and audit
> > the compiler for proper behaviour.
> 
> Fine by me - I thought you were advocating not loosening the
> definition.

We can't loosen it easilly.  For instance

int
q()
{
  while (1);
}

main()
{
  q();
  abort ();
}

Will abort if we will allow dead code removal on loosened constant calls.
Dead code removal is important feature. 

Honza
> 
> zw



More information about the Gcc-patches mailing list