[LLVMdev] [RFC] New function attributes for errno-setting functions

Hal Finkel hfinkel at anl.gov
Fri Sep 13 15:04:22 PDT 2013


----- Original Message -----
> 
> On Fri, Sep 13, 2013 at 2:07 PM, Hal Finkel < hfinkel at anl.gov >
> wrote:
> 
> 
> 
> 
> 
> ----- Original Message -----
> > 
> > Food for thought: If you have a codebase which can't use
> > -fno-math-errno, because it relies on errno values from math
> > functions, it may be a more effective long-term strategy to work on
> > modernizing your codebase, eliminating the dependencies on errno,
> > rather than going through the trouble of adding even more
> > complexity
> > to compilers to keep errno support limping along.
> > 
> 
> Wouldn't that require 'modernizing' POSIX? ;) How else can you get
> the error code from open() or any number of other functions
> 
> 
> open is not a math function.
> 

Sorry, I misread your initial statement... but this whole issue is not about codes that need errno from math functions; that's supported just fine now. The problem is that the math functions, whether you use the errno return or not, may write to errno. And, because we currently mark these functions as readnone when -fmath-errno=0, we might reorder these functions w.r.t. other functions that do set errno, like open, and from which we care about errno's value.

 -Hal

> 
> Dan
> 
> 

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



More information about the llvm-dev mailing list