[Bug c/28141] New: thread-local ptr initialized to address of thread-local misclassified as non-constant initializer

gary at intrepid dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 23 06:55:00 GMT 2006


Given the following:
     1  double __thread data;
     2  double __thread * ptr = &data;

leads to following error diagnostic:

% gcc -c t.c
t.c:3: error: initializer element is not constant

compiled with:
gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)

Given that both 'data' and 'ptr' are thread local, can the
address of 'data' be considered as constant?  If 'ptr' were declared
at file scope, then the initializer would be problematic, but as
a thread-local declaration, the initializer appears to be non-ambiguous.


-- 
           Summary: thread-local ptr initialized to address of thread-local
                    misclassified as non-constant initializer
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gary at intrepid dot com


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



More information about the Gcc-bugs mailing list