IBM Support

LI76743: 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

    LI76743

  • Reported component name

    XL C/C++ AE BG/

  • Reported component ID

    5799HJE00

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-05-09

  • Closed date

    2012-08-27

  • Last modified date

    2012-08-27

  • 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++ AE BG/

  • Fixed component ID

    5799HJE00

Applicable component levels

  • R900 PSY

       UP

[{"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:
17 October 2021