aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-05-08 08:20:45 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-05-08 08:20:45 +0000
commit1b674de05347bf855c4e06656cd8276715ee0092 (patch)
treee0980eeaca11a9f476d545834ecfe14de6369efe /gcc
parentb13e7b6cfc7ecbdd98cbff22e1b1a394c1f50dbc (diff)
downloadgcc-1b674de05347bf855c4e06656cd8276715ee0092.zip
gcc-1b674de05347bf855c4e06656cd8276715ee0092.tar.gz
gcc-1b674de05347bf855c4e06656cd8276715ee0092.tar.bz2
re PR middle-end/36154 (internal compiler error: in get_constraint_for_component_ref, at tree-ssa-structalias.c:2727)
2008-05-08 Richard Guenther <rguenther@suse.de> PR middle-end/36154 * tree-ssa-structalias.c (push_fields_onto_fieldstack): Make sure to create a representative for trailing arrays for PTA. * gcc.c-torture/compile/pr36154.c: New testcase. From-SVN: r135071
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr36154.c11
-rw-r--r--gcc/tree-ssa-structalias.c12
4 files changed, 30 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bdc4846..1121be1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2008-05-08 Richard Guenther <rguenther@suse.de>
+ PR middle-end/36154
+ * tree-ssa-structalias.c (push_fields_onto_fieldstack): Make
+ sure to create a representative for trailing arrays for PTA.
+
+2008-05-08 Richard Guenther <rguenther@suse.de>
+
PR middle-end/36172
* fold-const.c (operand_equal_p): Two objects which types
differ in pointerness are not equal.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 68626fd..2b137fa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2008-05-08 Richard Guenther <rguenther@suse.de>
+ PR middle-end/36154
+ * gcc.c-torture/compile/pr36154.c: New testcase.
+
+2008-05-08 Richard Guenther <rguenther@suse.de>
+
PR middle-end/36172
* gcc.c-torture/compile/pr36172.c: New testcase.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36154.c b/gcc/testsuite/gcc.c-torture/compile/pr36154.c
new file mode 100644
index 0000000..ae3eb83
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr36154.c
@@ -0,0 +1,11 @@
+struct eth_test_pkt {
+ unsigned short len;
+ unsigned short ctr;
+ unsigned char packet[];
+} __attribute__ ((packed));
+struct eth_test_pkt pkt_unaligned = { .packet = { 0xFC } };
+int cmd_unaligned(const void *p)
+{
+ return memcmp(p, pkt_unaligned.packet, 1);
+}
+
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index ddcf498..d58478e 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4160,11 +4160,15 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
(DECL_NONADDRESSABLE_P (field)
? addressable_type
: TREE_TYPE (field))))
- && DECL_SIZE (field)
- && !integer_zerop (DECL_SIZE (field)))
- /* Empty structures may have actual size, like in C++. So
+ && ((DECL_SIZE (field)
+ && !integer_zerop (DECL_SIZE (field)))
+ || (!DECL_SIZE (field)
+ && TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE)))
+ /* Empty structures may have actual size, like in C++. So
see if we didn't push any subfields and the size is
- nonzero, push the field onto the stack */
+ nonzero, push the field onto the stack. Trailing flexible
+ array members also need a representative to be able to
+ treat taking their address in PTA. */
push = true;
if (push)