https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69681

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gjl at gcc dot gnu.org

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #3)
> Either way, such code still fails to compile.

I still don't see how the compiler could determine the addresses of functions
as they are only determined at link time.  Just suppose functions drawn from a
library or where you are def'ing symbols in the linker description file or by
means of -Wl,--defsym,foo=bar.

There are even cases where functions with different prototypes reside at the
came address (because the functions are built-in, their implementation is in
libgcc and the compiler knows that the binary code is exactly the same even
though the prototypes are not.  The avr back-end has an example of this, cf.
PR78562 for an example).

So even if there are situations where such expressions can be folded to a
compile time constant, this is not possible in general.

If an application relies on this, it's likely to have a design problem.

Reply via email to