LLVM can produce zero length functions from cases like this (when optimizations are enabled): void f1() { __builtin_unreachable(); } int f2() { /* missing return statement */ } This code is valid, so long as the functions are never called. I believe C++ requires that all functions have a distinct address (ie: &f1 != &f2) and LLVM optimizes code on this basis (assert(f1 == f2) gets optimized into an unconditional assertion failure) But these zero length functions can end up with identical addresses. I'm unaware of anything in the C++ spec (or the LLVM langref) that would indicate that would allow distinct functions to have identical addresses - so should we do something about this in the LLVM backend? add a little padding? a nop instruction? (if we're adding an instruction anyway, perhaps we might as well make it an int3?) (I came across this due to DWARF issues with zero length functions & thinking about if/how this should be supported)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4