Consider this:

  __attribute__((weak)) extern int const K = 7;
  int f(void) { return K; }
  int a[K];

Assuming the combination of 'weak' and 'const' is legitimate
(and it seems useful enough to allow), the compiler should avoid
the constant-promotion optimization when generating f(), and
should fault a[].


-- 
           Summary: clarify/diagnose use of weak constant
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: algrant at acm dot org


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

Reply via email to