When / How does Linux load shared libraries into address space?

Libraries are loaded by ld.so (dynamic linker or run-time linker aka rtld, ld-linux.so.2 or ld-linux.so.* in case of Linux; part of glibc). It is declared as “interpreter” (INTERP; .interp section) of all dynamic linked ELF binaries. So, when you start program, Linux will start an ld.so (load into memory and jump to its entry point), … Read more

Can compiler optimization introduce bugs?

Compiler optimizations can introduce bugs or undesirable behaviour. That’s why you can turn them off. One example: a compiler can optimize the read/write access to a memory location, doing things like eliminating duplicate reads or duplicate writes, or re-ordering certain operations. If the memory location in question is only used by a single thread and … Read more

Learning Resources on Parsers, Interpreters, and Compilers [closed]

The best paper I ever read on compilers is dated 1964 “META II a syntax-oriented compiler writing language” by Val Schorre. (http://doi.acm.org/10.1145/800257.808896) In 10 pages, he shows you how to build an astoundingly simple but very effective compiler-compiler, provides you with with the compiler-compiler grammar and provides you with enough details for you to hand … Read more

Unexpected order of evaluation (compiler bug?) [duplicate]

There is a sequence point between evaluating arguments and calling a function. There is no sequence point between evaluating different arguments. Let’s look at the outermost function call: operator<<(operator<<(operator<<(std::cout, n++), n), ++n) The arguments are operator<<(operator<<(std::cout, n++), n) and ++n It is unspecified which of these is evaluated first. It’s also allowed that the first … Read more