boost spirit V2 qi bug associated with optimization level

It’s a bug in your code, nothing wrong with the compiler or the optimization levels. The cinch is with expression templates (like the ones used by Boost Proto, and hence by Boost Spirit). They are only valid to the end of their enclosing full expression [1] The canonical workaound is: BOOST_SPIRIT_AUTO(ana, *~qi::char_(‘*’) > +qi::char_(‘*’)); You … Read more

Are floating point operations in C associative?

The compiler is not allowed to perform “optimizations”, which would result in a different value computed, than the one computed according to abstract machine semantics. 5.1.2.3 Program execution [#1] The semantic descriptions in this International Standard describe the behavior of an abstract machine in which issues of optimization are irrelevant. [#3] In the abstract machine, … Read more

Why is the empty base class optimization (EBO) is not working in MSVC?

This is a longstanding bug in the Visual C++ compiler. When a class derives from multiple empty base classes, only the initial empty base class will be optimized using the empty base optimization (EBO). This issue was reported on Microsoft Connect in 2006: Empty Base Optimization Not Working Properly. At the moment, old bugs are … Read more

Why can’t C compilers rearrange struct members to eliminate alignment padding? [duplicate]

There are multiple reasons why the C compiler cannot automatically reorder the fields: The C compiler doesn’t know whether the struct represents the memory structure of objects beyond the current compilation unit (for example: a foreign library, a file on disc, network data, CPU page tables, …). In such a case the binary structure of … Read more

How to turn off gcc compiler optimization to enable buffer overflow

That’s a good problem. In order to solve that problem you will also have to disable ASLR otherwise the address of g() will be unpredictable. Disable ASLR: sudo bash -c ‘echo 0 > /proc/sys/kernel/randomize_va_space’ Disable canaries: gcc overflow.c -o overflow -fno-stack-protector After canaries and ASLR are disabled it should be a straight forward attack like … Read more