https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114526
--- Comment #12 from Kaz Kylheku <kkylheku at gmail dot com> --- (In reply to Harald van Dijk from comment #10) > Sorry, sent my earlier comment too soon. > > (In reply to Joseph S. Myers from comment #8) > > I believe conversions between function and object pointers are undefined as > > a property of the translation unit - not of a particular execution. > > But there is nothing in the standard to support this. The standard fully > defines the behaviour of the program I posted, which is just to return 0. It does not. You're relying on the implementation (1) glossing over the undefined conversion at translation time (or supporting it as an extension) and then (2) optimization removing whatever code was generated for it since the value is unused. The standard does not define the conversion, by omission of defined behavior. Moreover, the omission isn't absolute. There is a non-normative mention of this conversion in an informative Annex which acknowledges the conversion as a common extension. That tells us that the omission of a definition of behavior from the normative text is known, and deliberate. Undefined behavior means that the implementation is permitted to stop, at translation or execution time, with or without the issuance of a diagnostic message. Moreover, implementations are not required to optimize. If the abstract semantics of your program is executed literally, then there will be an undefined conversion performed, whose value is then discarded in the expression-statement.