typedef __SIZE_TYPE__ size_t; struct E { virtual ~E () {} virtual size_t e () const = 0; virtual void f (char *x) const = 0; }; struct F : public E { virtual ~F () {} virtual size_t e () const { return 0; } virtual void f (char *x) const { *x = '\0'; } }; struct S { S () { a = new char[32]; b = 32; c = 0; a[0] = 0; } void s (const char *x, size_t y) { v (c + y + 1); __builtin_memcpy(a + c, x, y); c += y; a[c] = '\0'; } void s (const E *x) { size_t l = x->e(); v (c + l + 1); x->f (a + c); c += l; } const char *t () { return a; } void v (size_t n) { if (b >= n) return; size_t b2 = b; char *a2 = a; for (;;) { b *= 2; if (b >= n) break; } a = new char[b]; if (b2) { __builtin_memcpy(a, a2, c); a2[0] = 0; for (size_t i = 1; i < b2; i++) a2[i] = a2[i - 1]; delete[] a2; } } ~S () { if (b) { a[0] = 0; for (size_t i = 1; i < b; i++) a[i] = a[i - 1]; } delete[] a; } char * a; size_t b, c; }; const char *p; size_t q; const F u; const char * foo () { S s; s.s (p, q); s.s (&u); return s.t (); } ICEs at -O{1,2,3} in coalesce_abnormal_edges, at least on x86_64 and i386 linux.
This worked in "4.1.0 20060208" and in "4.1.0 20051026".
Does the patch for PR 27283 fix this?
*** Bug 27550 has been marked as a duplicate of this bug. ***
*** Bug 27551 has been marked as a duplicate of this bug. ***
Yes, PR 27283 patch fixes this. So, we need it on gcc-4_1-branch too...
Confirmed.
Created attachment 11468 [details] gcc41-pr27549.patch
Created attachment 11469 [details] gcc41-pr27548.patch These two patches fix this on the branch, bootstrapped/regtested on 7 linux arches. But, PR27548 fix hasn't been approved for the trunk yet, so I'll post these 2 to gcc-patches only when that happens.
Subject: Bug 27549 Author: jakub Date: Wed May 17 08:23:55 2006 New Revision: 113843 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113843 Log: PR tree-optimization/27549 Backported from mainline 2006-05-01 Zdenek Dvorak <dvorakz@suse.cz> PR tree-optimization/27283 * tree-ssa-loop-ivopts.c (struct nfe_cache_elt): Store just trees, not whole # of iteration descriptions. (niter_for_exit): Return just # of iterations. Fail if # of iterations uses abnormal ssa name. (niter_for_single_dom_exit): Ditto. (find_induction_variables, may_eliminate_iv): Expect niter_for_exit to return just the number of iterations. (add_iv_outer_candidates, may_replace_final_value): Likewise. * g++.dg/tree-ssa/pr27283.C: New test. * g++.dg/tree-ssa/pr27549.C: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/tree-ssa/pr27283.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/tree-ssa/pr27549.C Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/tree-ssa-loop-ivopts.c
Subject: Bug 27549 Author: jakub Date: Wed May 17 08:31:51 2006 New Revision: 113845 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113845 Log: PR tree-optimization/27549 * g++.dg/tree-ssa/pr27549.C: New test. Added: trunk/gcc/testsuite/g++.dg/tree-ssa/pr27549.C Modified: trunk/gcc/testsuite/ChangeLog
Fixed in SVN.