IBM Support

IZ40798: 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
    functionality confirmed.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ40798

  • Reported component name

    XLC C++ AIX

  • Reported component ID

    5724S7100

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-01-02

  • Closed date

    2012-05-09

  • Last modified date

    2012-05-09

  • 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

    XLC C++ AIX

  • Fixed component ID

    5724S7100

Applicable component levels

  • R900 PSY

       UP

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

Document Information

Modified date:
04 October 2021