Bug 79288 - [7 Regression] TLS model wrong for static data members since r241137
Summary: [7 Regression] TLS model wrong for static data members since r241137
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.0
: P1 normal
Target Milestone: 7.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-30 17:28 UTC by Jakub Jelinek
Modified: 2017-02-15 17:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-01-30 00:00:00


Attachments
gcc7-pr79288.patch (858 bytes, patch)
2017-01-30 18:01 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2017-01-30 17:28:29 UTC
Since r241137

struct S
{
  static __thread int *p;
};

int *
foo ()
{
  return S::p;
}

emits for non-pic code TLS local exec model relocations instead of initial exec.
Comment 1 Jakub Jelinek 2017-01-30 17:29:24 UTC
The definition of the static data member could be of course in some shared library the binary is linked against.  As I've caused this, I'll debug this tomorrow.
Comment 2 Jakub Jelinek 2017-01-30 18:01:13 UTC
Created attachment 40626 [details]
gcc7-pr79288.patch

Untested fix.
Comment 3 Jakub Jelinek 2017-02-14 10:16:49 UTC
Fix posted for review: http://gcc.gnu.org/ml/gcc-patches/2017-01/msg02349.html
Comment 4 Jakub Jelinek 2017-02-15 17:09:50 UTC
Author: jakub
Date: Wed Feb 15 17:09:18 2017
New Revision: 245488

URL: https://gcc.gnu.org/viewcvs?rev=245488&root=gcc&view=rev
Log:
	PR c++/79288
	* decl.c (grokdeclarator): For static data members, handle thread_p
	only after handling inline.

	* g++.dg/tls/pr79288.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/tls/pr79288.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2017-02-15 17:35:28 UTC
Fixed.