Serious code generation bug introduced in latest snapshot (egcs-2.92.18)
Mark Mitchell
mark@markmitchell.com
Tue Nov 3 00:51:00 GMT 1998
Roberto> In summary, the class PatternArgs contains a vector of
Roberto> dimension 1 of PatternPtr, PatternPtr patterns[1].
Roberto> PatternPtr is a shorthand for MHeapPtr<Pattern>, where
Roberto> MHeapPtr is a templatized class of smart pointers.
My mistake. Here's the patch.
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com
1998-11-02 Mark Mitchell <mark@markmitchell.com>
* init.c (expand_vec_init): Fix off-by-one error.
Index: testsuite/g++.old-deja/g++.other/init10.C
===================================================================
RCS file: init10.C
diff -N init10.C
*** /dev/null Mon Dec 31 20:00:00 1979
--- init10.C Mon Nov 2 22:03:17 1998
***************
*** 0 ****
--- 1,22 ----
+ int i;
+
+ struct D {
+ D () {
+ i++;
+ }
+ };
+
+ struct C {
+ C() {}
+
+ D d[1];
+ };
+
+
+ int main ()
+ {
+ C c;
+
+ if (i != 1)
+ return 1;
+ }
Index: cp/init.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/init.c,v
retrieving revision 1.76
diff -c -p -r1.76 init.c
*** init.c 1998/11/01 15:45:04 1.76
--- init.c 1998/11/03 06:03:19
*************** expand_vec_init (decl, base, maxindex, i
*** 2853,2862 ****
&& !(TREE_CODE (maxindex) == INTEGER_CST
&& num_initialized_elts == TREE_INT_CST_LOW (maxindex) + 1))
{
! /* If the ITERATOR is equal to zero, then we don't have to loop;
we've already initialized all the elements. */
expand_start_cond (build (NE_EXPR, boolean_type_node,
! iterator, integer_zero_node),
0);
/* Otherwise, loop through the elements. */
--- 2853,2862 ----
&& !(TREE_CODE (maxindex) == INTEGER_CST
&& num_initialized_elts == TREE_INT_CST_LOW (maxindex) + 1))
{
! /* If the ITERATOR is equal to -1, then we don't have to loop;
we've already initialized all the elements. */
expand_start_cond (build (NE_EXPR, boolean_type_node,
! iterator, minus_one),
0);
/* Otherwise, loop through the elements. */
More information about the Gcc-bugs
mailing list