PR tree-optimization/39394
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Mar 2009 14:01:29 +0000 (14:01 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Mar 2009 14:01:29 +0000 (14:01 +0000)
* gimplify.c (gimplify_type_sizes): Gimplify DECL_SIZE and
DECL_SIZE_UNIT of variable length FIELD_DECLs.

* gcc.c-torture/compile/pr39394.c: New test.

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

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr39394.c [new file with mode: 0644]

index 300507d..341bcc6 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/39394
+       * gimplify.c (gimplify_type_sizes): Gimplify DECL_SIZE and
+       DECL_SIZE_UNIT of variable length FIELD_DECLs.
+
 2009-03-09  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        * recog.c (verfiy_changes): Disallow renaming of hard regs in
index 02d4923..b0c6592 100644 (file)
@@ -7141,6 +7141,8 @@ gimplify_type_sizes (tree type, gimple_seq *list_p)
        if (TREE_CODE (field) == FIELD_DECL)
          {
            gimplify_one_sizepos (&DECL_FIELD_OFFSET (field), list_p);
+           gimplify_one_sizepos (&DECL_SIZE (field), list_p);
+           gimplify_one_sizepos (&DECL_SIZE_UNIT (field), list_p);
            gimplify_type_sizes (TREE_TYPE (field), list_p);
          }
       break;
index 0651163..5329e90 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/39394
+       * gcc.c-torture/compile/pr39394.c: New test.
+
 2009-03-09  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        * gcc.target/s390/20090223-1.c: New testcase.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39394.c b/gcc/testsuite/gcc.c-torture/compile/pr39394.c
new file mode 100644 (file)
index 0000000..325a08f
--- /dev/null
@@ -0,0 +1,28 @@
+/* PR tree-optimization/39394 */
+
+char *p;
+int x;
+
+static inline void
+f1 (int n)
+{
+  asm volatile ("" : "=m" (*(struct { char x[n]; } *) p));
+}
+
+static inline void
+f2 (void)
+{
+  x ? f1 (1) : f1 (2);
+}
+
+static inline void
+f3 (void)
+{
+  f2 ();
+}
+
+void
+f4 (void)
+{
+  f3 ();
+}