[LLVMdev] Helping the optimizer along (__assume)

Mike Stump mrs at apple.com
Thu Oct 23 08:47:50 PDT 2008

On Oct 22, 2008, at 5:47 PM, Kenneth Boyd wrote:
> One generalization I would like to see (perhaps after spending enough
> time to understand how to safely inject attributes or _Pragma via
> macros) is how to make an assert generate syntax errors when it is
> provably violated even in release mode.

I like this idea.  Sounds good.  One can imagine enrolling static  
analysis and automated theorem provers to help out on the harder  
problems.  :-)

> (Am I misreading C99/C0X/C++98/C++0x: does the exact specification of
> the expansion of assert in release mode prohibit slipping in a _Pragma
> or other implementation-extension constructs to inject flow of control
> constraints?)

Technically, yes, but we can reword future standards to have the  
latitude to give compilation errors for conditions that can be proved  
to be false, then the implementation is conforming.  We could always  
have a flag to control the behavior if people want/need it, though, I  
can't hardly see why they'd want it to compile if they assert  
something that is false.

More information about the llvm-dev mailing list