re PR middle-end/50141 (ICE: tree check: expected var_decl, have parm_decl in get_bit...
authorJakub Jelinek <jakub@redhat.com>
Mon, 22 Aug 2011 15:00:06 +0000 (17:00 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 22 Aug 2011 15:00:06 +0000 (17:00 +0200)
PR middle-end/50141
* 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.

From-SVN: r177957

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

index 15c4e3ba24c84fb52f5fce3bc50390c188c7096b..14ab85913506f805a1feae56f9a5c7a54ca0f67f 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 82873eb8376b6a3d28cbc3f115f2d43334906d1c..ee16b6a469ea8dd774ad0b69241842997127bcc5 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 f7df8c1db9d4530ffbecb5110c95a7cc504c3fa6..72feb20c49310c8371789e87c4d4d9f05a6c521a 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);
+}