http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51460

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-08
          Component|c++                         |middle-end
   Target Milestone|---                         |4.6.3
            Summary|[4.6 regression] Struct     |[4.6/4.7 Regression] Struct
                   |with two boost mutexes      |with two boost mutexes
                   |allocated on the heap       |allocated on the heap
                   |inside of a while loop      |inside of a while loop
                   |causes compiler segfault    |causes compiler segfault
     Ever Confirmed|0                           |1

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-08 
10:05:34 UTC ---
Confirmed with -O1.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000bb9511 in VEC_edge_base_index (vec_=0x7ffff52e2cf8, ix_=0,
file_=Cannot access memory at address 0x7fffff7feff8
)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/basic-block.h:64
64      DEF_VEC_P(edge);
(gdb) bt
#1  0x0000000000bb9500 in ei_edge (i=...)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/basic-block.h:671
#2  0x0000000000bb942d in ei_cond (ei=..., p=0x7fffff7ff0e8)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/basic-block.h:692
#3  0x0000000000bbdd75 in predict_paths_for_bb (cur=0x7ffff19a3888, 
    bb=0x7ffff1b2f270, pred=PRED_CONTINUE, taken=NOT_TAKEN)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/predict.c:1801
#4  0x0000000000bbdda6 in predict_paths_for_bb (cur=0x7ffff1b2f270, 
    bb=0x7ffff1b2f270, pred=PRED_CONTINUE, taken=NOT_TAKEN)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/predict.c:1836
...

we endlessly recurse in predict_paths_for_bb walking

  for (son = first_dom_son (CDI_POST_DOMINATORS, cur);
       son;
       son = next_dom_son (CDI_POST_DOMINATORS, son))
    predict_paths_for_bb (son, bb, pred, taken);

(we never do anything else in the loop above it).  Sequence of recursion
is (cur, bb): (7, 9) (3, 3) (9, 9) (7, 9) ...

;; basic block 2, loop depth 0, count 0
;; prev block 0, next block 9
;; pred:       ENTRY (fallthru,exec)
;; succ:       9 [100.0%]  (fallthru)
<bb 2>:

;; basic block 9, loop depth 1, count 0
;; prev block 2, next block 3
;; pred:       2 [100.0%]  (fallthru) 7 (fallthru,exec)
;; succ:       3 [100.0%]  (fallthru,exec) 8 (eh,exec)
<bb 9>:
f_1 = operator new (80);
D.102841_9 = &f_1->bar;
boost::mutex::mutex (D.102841_9);

;; basic block 3, loop depth 1, count 0
;; prev block 9, next block 4
;; pred:       9 [100.0%]  (fallthru,exec)
;; succ:       7 [100.0%]  (fallthru,exec) 4 (eh,exec)
<bb 3>:
D.102840_10 = &f_1->baz;
boost::mutex::mutex (D.102840_10);
goto <bb 7>;

;; basic block 7, loop depth 1, count 0
;; prev block 6, next block 8
;; pred:       3 [100.0%]  (fallthru,exec)
;; succ:       9 (fallthru,exec)
<bb 7>:
// predicted unlikely by continue predictor.
goto <bb 9>;

... so it seems post-dominators do not honor EH-edges, or at least
it is inconsistent with the way we add fake exit edges for infinite
loops.

Reply via email to