https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85400

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2018-04-16
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> In Solaris 10 & 11 using GCC versions 4.8, 4.9.2, 7.2.0 I get relocation
> errors when thread_local variables are used in a struct/class.  Example code
> that reproduces the problem:
> 
> > struct Test {
> >   int blah( int y ) {
> >     thread_local mything = 3;
> >     mything = y > 0 ? y : mything;
> >     return mything;
> >   }
> > };
> > int stuff( Test& test, int y ) {
> >   return test.blah(y);
> > }

This doesn't compile for me:

pr85400.C: In member function 'int Test::blah(int)':
pr85400.C:5:18: error: 'mything' does not name a type
     thread_local mything = 3;
                  ^~~~~~~
pr85400.C:6:5: error: 'mything' was not declared in this scope
     mything = y > 0 ? y : mything;
     ^~~~~~~

> * The compilers I built and those produced by OpenCSW use the Solaris
> assembler (/usr/ccs/bin/as) instead of gas.

Do you have local patches?  My compiler is the stock GCC 8.x:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/nfs/homes/homes/botcazou/gcc-head/install_sparc/bin/../libexec/gcc/sparc-sun-solaris2.10/8.0.1/lto-wrapper
Target: sparc-sun-solaris2.10
Configured with: /homes/botcazou/gcc-head/src/configure
--build=sparc-sun-solaris2.10 --prefix=/homes/botcazou/gcc-head/install_sparc
--with-as=/homes/botcazou/gcc-head/install_sparc/bin/as
--with-gmp=/homes/botcazou/support/sparc
--with-mpfr=/homes/botcazou/support/sparc
--with-mpc=/homes/botcazou/support/sparc --enable-languages=all --disable-nls
Thread model: posix
gcc version 8.0.1 20180325 (experimental) (GCC)

Reply via email to