OSDN Git Service

PR middle-end/50141
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Aug 2011 15:00:06 +0000 (15:00 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Aug 2011 15:00:06 +0000 (15:00 +0000)
* expr.c (get_bit_range): Only use DECL_THREAD_LOCAL_P if
innerdecl is a VAR_DECL.

* c-c++-common/cxxbitfields-6.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177957 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/cxxbitfields-6.c [new file with mode: 0644]

index 15c4e3b..14ab859 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/50141
+       * expr.c (get_bit_range): Only use DECL_THREAD_LOCAL_P if
+       innerdecl is a VAR_DECL.
+
 2011-08-22  Kirill Yukhin  <kirill.yukhin@intel.com>
 
        * config/i386/avx2intrin.h: New file.
index 82873eb..ee16b6a 100644 (file)
@@ -4354,7 +4354,8 @@ get_bit_range (unsigned HOST_WIDE_INT *bitstart,
           || TREE_CODE (innerdecl) == TARGET_MEM_REF)
          && !ptr_deref_may_alias_global_p (TREE_OPERAND (innerdecl, 0)))
       || (DECL_P (innerdecl)
-         && (DECL_THREAD_LOCAL_P (innerdecl)
+         && ((TREE_CODE (innerdecl) == VAR_DECL
+              && DECL_THREAD_LOCAL_P (innerdecl))
              || !TREE_STATIC (innerdecl))))
     {
       *bitstart = *bitend = 0;
index f7df8c1..72feb20 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/50141
+       * c-c++-common/cxxbitfields-6.c: New test.
+
 2011-08-22  Mikael Morin  <mikael.morin@gcc.gnu.org>
 
        PR fortran/50050
diff --git a/gcc/testsuite/c-c++-common/cxxbitfields-6.c b/gcc/testsuite/c-c++-common/cxxbitfields-6.c
new file mode 100644 (file)
index 0000000..bdd6294
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR middle-end/50141 */
+/* { dg-do compile } */
+/* { dg-options "-O2 --param allow-store-data-races=0" } */
+
+struct S
+{
+  int i:8;
+};
+
+void bar (struct S, int);
+
+void
+foo (struct S s, int i)
+{
+  s.i = i;
+  bar (s, i);
+}