Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(91)

Issue 4607047: [pph] Fix GC ICE in g++.dg/pph/c1eabi.cc (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 10 months ago by Diego Novillo
Modified:
13 years, 10 months ago
Reviewers:
CC:
Lawrence Crowl, Gabriel Charette, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -11 lines) Patch
M gcc/cp/class.c View 2 chunks +6 lines, -3 lines 0 comments Download
M gcc/testsuite/g++.dg/pph/c1eabi1.h View 1 chunk +0 lines, -4 lines 0 comments Download
M gcc/testsuite/g++.dg/pph/c1eabi1.cc View 1 chunk +1 line, -4 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
13 years, 10 months ago (2011-06-13 19:09:02 UTC) #1
We were running into a GC ICE because when reading a sorted_fields_type
field we were never setting the lenght of the vector.

This patch moves the setting of the vector length to the actual
allocation function (sorted_fields_type_new).  It was being done in
finish_struct_1 before, so vectors read from the streamer were getting
garbage in the len field.

This fixes g++.dg/pph/c1eabi.{cc,h}.  Tested on x86_64.  Committed to
branch.


Diego.


cp/ChangeLog.pph

	* class.c (sorted_fields_type_new): Set field LEN in the
	newly allocated vector.
	(finish_struct_1): Remove setting of FIELD_VEC->LEN.

testsuite/ChangeLog.pph

	* g++.dg/pph/c1eabi1.h: Remove XFAIL markers.
	* g++.dg/pph/c1eabi1.cc: Likewise.
	Add assembly mis-comparison expectation.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 86ec04b..70a3668 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5579,8 +5579,12 @@ determine_key_method (tree type)
 struct sorted_fields_type *
 sorted_fields_type_new (int n)
 {
-  return ggc_alloc_sorted_fields_type (sizeof (struct sorted_fields_type)
-				       + n * sizeof (tree));
+  struct sorted_fields_type *sft;
+  sft = ggc_alloc_sorted_fields_type (sizeof (struct sorted_fields_type)
+				      + n * sizeof (tree));
+  sft->len = n;
+
+  return sft;
 }
 
 
@@ -5714,7 +5718,6 @@ finish_struct_1 (tree t)
   if (n_fields > 7)
     {
       struct sorted_fields_type *field_vec = sorted_fields_type_new (n_fields);
-      field_vec->len = n_fields;
       add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0);
       qsort (field_vec->elts, n_fields, sizeof (tree),
 	     field_decl_cmp);
diff --git a/gcc/testsuite/g++.dg/pph/c1eabi1.cc
b/gcc/testsuite/g++.dg/pph/c1eabi1.cc
index 6271501..b2e9b11 100644
--- a/gcc/testsuite/g++.dg/pph/c1eabi1.cc
+++ b/gcc/testsuite/g++.dg/pph/c1eabi1.cc
@@ -1,7 +1,4 @@
-// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "mathcalls.h:365:1: internal compiler error: Segmentation fault"
"" { xfail *-*-* } 0 }
-// { dg-prune-output "In file included from " }
-// { dg-prune-output "                 from " }
 // { dg-options "-w -fpermissive" }
+// pph asm xdiff
 
 #include "c1eabi1.h"
diff --git a/gcc/testsuite/g++.dg/pph/c1eabi1.h
b/gcc/testsuite/g++.dg/pph/c1eabi1.h
index 151b768..5f5b593 100644
--- a/gcc/testsuite/g++.dg/pph/c1eabi1.h
+++ b/gcc/testsuite/g++.dg/pph/c1eabi1.h
@@ -1,7 +1,3 @@
-// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "mathcalls.h:365:1: internal compiler error: Segmentation fault"
"" { xfail *-*-* } 0 }
-// { dg-prune-output "In file included " }
-// { dg-prune-output "                 from " }
 // { dg-options "-w -fpermissive" }
 
 #ifndef __PPH_GUARD_H

--
This patch is available for review at http://codereview.appspot.com/4607047
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b