https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85400
--- Comment #2 from Brian Vandenberg <phantall at gmail dot com> --- Sorry, I was hand-typing from an air-gapped network. I left the type name out; line 5 should read: > thread_local int mything = 3; -brian On Mon, Apr 16, 2018 at 2:52 AM, ebotcazou at gcc dot gnu.org < gcc-bugzi...@gcc.gnu.org> wrote: > 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) > > -- > You are receiving this mail because: > You reported the bug. >