Re: Optimisations and undefined behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2015-11-09 15:11:27 -0700, Jeff Law wrote:
> I feel it's best to err on the side of safety here -- given a function call,
> loops and the like, we have to consider the possibility that the statement
> which exhibits UB may not be executed.  And until that statement is
> executed, we have no license to do anything weird.

BTW, the C standard says that a function may be interrupted by a
signal at any time. So, if some code that has a visible side effect
appears before an UB, the program may be interrupted between this
code and the UB so that the UB will not occur. Thus a compiler does
not have the license to remove such code with side effect.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux