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

--- Comment #11 from Florian Weimer <fw at gcc dot gnu.org> ---
Created attachment 39799
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39799&action=edit
label.c

(In reply to Andrew Pinski from comment #6)
> Not always since they could be in different sections via -ffunction-sections
> or the user put them into different sections.  The layout of the sections is
> not known until link time.

For label differences, the difference is only known at assembly time, not
compile time.  So you can really evaluate the constant in GCC, either.  You can
even get assembler warnings and incorrect data, as the attached code shows.  It
produces an assembler warning for me:

/tmp/ccAMdJhn.s: Assembler messages:
/tmp/ccAMdJhn.s:1237: Warning: value 0x1680 truncated to 0x80

(The reproducer is slightly convoluted to work around bug 77951.)

There might also be targets where label differences are only known at link
time, too.

Reply via email to