[cfe-dev] [RFC] A proposal for #pragma optnone

Hal Finkel hfinkel at anl.gov
Tue Apr 29 14:58:42 PDT 2014


----- Original Message -----
> From: "Paul Robinson" <Paul_Robinson at playstation.sony.com>
> To: "Hal Finkel" <hfinkel at anl.gov>, "Chandler Carruth" <chandlerc at google.com>
> Cc: "clang-dev Developers" <cfe-dev at cs.uiuc.edu>
> Sent: Tuesday, April 29, 2014 4:53:38 PM
> Subject: RE: [cfe-dev] [RFC] A proposal for #pragma optnone
> 
> > > I think reducing the proliferation of pragmas is a good thing, so
> > > let's implement the GCC syntax. We can add support for the MSVC
> > > syntax later. We probably want to defer that because the primary
> > > use
> > > case for it is working around MSVC miscompiles.
> > >
> > >
> > > Why doesn't this logic apply to both? I don't *really* care how
> > > it is
> > > spelled (I agree with Renato that we can discourage it
> > > regardless)
> > > I'm just not sure that the concern of existing usage primarily
> > > working around compiler-specific miscompiles is MSVC specific.
> > >
> > > Usually these workarounds have a version check around them that
> > > we
> > > miss, like _MSC_VER < 1700. I wonder if the same is true for
> > > __GNUC__ usage.
> > >
> > >
> > > It also occurs to me that if we add this pragma, users might use
> > > it
> > > to work around "miscompiles" of invalid user code. On the other
> > > hand, it's not like Clang is bug-free either.
> > > Yea, I'm just curious why we don't want a clang-specific spelling
> > > so
> > > that we don't pick up any of these. :: shrug :: Note that we
> > > emulate
> > > a GCC version that is not useful for reasoning about live
> > > miscompile
> > > bugs.
> > 
> > +1 -- We specifically don't want to pick up any of these from other
> > compilers.
> > 
> >  -Hal
> > 
> > >
> > >
> > > I would still try to spell it the same as GCCs if convenient:
> > > "#pragma clang optimize 0" or whatever.
> 
> Um.  Spell it like GCC's but put it in the clang namespace so that
> it isn't spelled like GCC's?  <Tries to envision a rationale>
> 
> So that way it looks kinda familiar to GCC users, but if there are
> any actual GCC directives in the source, we don't actually implement
> them, assuming they're there to avoid GCC miscompiles but clang isn't
> GCC and so won't have the same miscompile issues...  (Am I at all
> close?)
> 

Personally, I don't care that it is spelled like gcc's pragma. But I suppose having it (however it is spelled), and I think that it should not be spelled exactly like gcc's pragma. There seemed to be some opinions (by other people) that we don't want to invent new pragmas, thus the rationale for emulating gcc, but in this particular case, we *want* incompatibility, and so I don't find their arguments compelling.

 -Hal

> --paulr
> 
> 
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-dev mailing list