Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which functions are affected by -fno-math-errno?

I have been excited by this post: https://stackoverflow.com/a/57674631/2492801 and I consider using -fno-math-errno. But I would like to be sure that I do not harm the behaviour of the software I am working on.

Therefore I have checked the (rather large) codebase to see where errno is being used and I wanted to decide whether these usages interfere with -fno-math-errno. But how to do that? The documentation says:

-fno-math-errno

Do not set errno after calling math functions that are executed with a single instruction, e.g., sqrt...

But how can I know which math functions are executed with a single instruction? Is this documented somewhere? Where?

It seems as if the codebase I use relies on errno especially when calling strtol and when working with streams. I guess that strtol is not executed with a single instruction. Is it considered to be a math function at all? How can I be sure?

like image 739
Benjamin Bihler Avatar asked Aug 27 '19 14:08

Benjamin Bihler


People also ask

What controls the different functions in the body?

The brain is like a computer that controls the body's functions, and the nervous system is like a network that relays messages to parts of the body.

What functions do life functions depend on?

The basic processes of life include organization, metabolism, responsiveness, movements, and reproduction. In humans, who represent the most complex form of life, there are additional requirements such as growth, differentiation, respiration, digestion, and excretion. All of these processes are interrelated.

What is the function of the body?

Your basic function as an organism is to consume (ingest) energy and molecules in the foods you eat, convert some of it into fuel for movement, sustain your body functions, and build and maintain your body structures. There are two types of reactions that accomplish this: anabolism and catabolism.

What are the functions of the brain?

The brain is a complex organ that controls thought, memory, emotion, touch, motor skills, vision, breathing, temperature, hunger and every process that regulates our body. Together, the brain and spinal cord that extends from it make up the central nervous system, or CNS.


1 Answers

You can find list of functions affected by -fno-math-errno in GCC's builtins.def (search for "ERRNO"). It seems that only some functions from math.h header (cos, sin, exp, etc.) are affected. Treatment of other standard functions that use errno (strtol, etc.) will not change under this flag.

like image 159
yugr Avatar answered Oct 12 '22 22:10

yugr