IBM Support

LI74057: STATIC MEMBER __THREAD VARIABLE ISSUE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following error is received when compiling this testcase:
    "1540-2638 (S) The __thread keyword can only be specified for
    external or static data."
    ______________________________________________________________
    ______________________________________________________________
    ______________________________________________________________
    
    #include <omp.h>
    
    
    class A
    {
      public:
        static __thread int localInt;
    };
    __thread int A::localInt;
    
    int main ()
    {
      A::localInt = 10;
      printf( "Static's value: %d\n", A::localInt );
       return 0;
    }
    

Local fix

  • Use namespace scoped thread static variables instead of member
    thread static variables.
    
    ______________________________________________________________
    ______________________________________________________________
    
    For example:
    
    namespace A
    {
        static __thread int localInt;
    };
    
    Instead of:
    
    class A
    {
      public:
        static __thread int localInt;
    };
    __thread int A::localInt;
    

Problem summary

  • thread static local and thread static data member variables.
    
    Invalid error diagnostic emitted by compiler.
    

Problem conclusion

  • The invalid diagnostics have been corrected and correct TLS
    functionality confirmed.  Backfix of 322827, 322827.1 and
    346167, all relating to incorrect TLS diagnostics.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI74057

  • Reported component name

    XL C/C++ RHEL5

  • Reported component ID

    5724S7310

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2008-12-17

  • Closed date

    2008-12-17

  • Last modified date

    2008-12-17

  • APAR is sysrouted FROM one or more of the following:

    IZ34321

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ RHEL5

  • Fixed component ID

    5724S7310

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
16 October 2021