]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/42570 (ICE in get_alias_set, at alias.c:710)
authorRichard Guenther <rguenther@suse.de>
Fri, 1 Jan 2010 17:19:02 +0000 (17:19 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 1 Jan 2010 17:19:02 +0000 (17:19 +0000)
2010-01-01  Richard Guenther  <rguenther@suse.de>

PR c/42570
* c-decl.c (grokdeclarator): For zero-size arrays force
structural equality checks as layout_type does.

* gcc.c-torture/execute/pr42570.c: New testcase.

From-SVN: r155557

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr42570.c [new file with mode: 0644]

index d7f73070448ee51db2ab3742a516fe87d0248163..7db96755ad35d2ecfa5f15eeb73353b51c8cb0ca 100644 (file)
@@ -1,3 +1,9 @@
+2010-01-01  Richard Guenther  <rguenther@suse.de>
+
+       PR c/42570
+       * c-decl.c (grokdeclarator): For zero-size arrays force
+       structural equality checks as layout_type does.
+
 2010-01-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        * builtins.c: Update copyright to 2010.
index 0655197f5bc819943c24269556caf5631da84679..a244a83e7878eb8be72b50f0029938214c8c7da4 100644 (file)
@@ -1,6 +1,6 @@
 /* Process declarations and variables for C compiler.
    Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -5394,6 +5394,7 @@ grokdeclarator (const struct c_declarator *declarator,
                    gcc_assert (itype);
                    TYPE_SIZE (type) = bitsize_zero_node;
                    TYPE_SIZE_UNIT (type) = size_zero_node;
+                   SET_TYPE_STRUCTURAL_EQUALITY (type);
                  }
                if (array_parm_vla_unspec_p)
                  {
@@ -5401,6 +5402,7 @@ grokdeclarator (const struct c_declarator *declarator,
                    /* The type is complete.  C99 6.7.5.2p4  */
                    TYPE_SIZE (type) = bitsize_zero_node;
                    TYPE_SIZE_UNIT (type) = size_zero_node;
+                   SET_TYPE_STRUCTURAL_EQUALITY (type);
                  }
              }
 
index 4608794896961fad0580be1b3ce723d5e41b7835..35ea64b52b32830229801ade7c42cd5d62a515a2 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-01  Richard Guenther  <rguenther@suse.de>
+
+       PR c/42570
+       * gcc.c-torture/execute/pr42570.c: New testcase.
+
 2010-01-01  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/42559
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr42570.c b/gcc/testsuite/gcc.c-torture/execute/pr42570.c
new file mode 100644 (file)
index 0000000..99a8d80
--- /dev/null
@@ -0,0 +1,9 @@
+typedef unsigned char uint8_t;
+uint8_t foo[1][0];
+extern void abort (void);
+int main()
+{
+  if (sizeof (foo) != 0)
+    abort ();
+  return 0;
+}