extern char x[] __attribute__((__weak__));
int i = (long)x;

results in 'initializer element is not computable at load time'. However, the
compiler really can't know this, as x may be either zero (since it's weak) or
may be used as C-level place holder for an assembler/linker defined absolute
symbol. While emitting a warning here (that should have a control for
suppressing) seems appropriate, failing the compilation isn't - that decision
should be left to the assembler (in case the target doesn't have an
appropriately sized relocation type) or the linker.


-- 
           Summary: potentially valid construct rejected
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jbeulich at novell dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33437

Reply via email to