c++/10401: [3.3/3.4 regression] Seg fault with "-pedantic -Wunreachable-code"

bangerth@dealii.org bangerth@dealii.org
Mon Apr 14 17:04:00 GMT 2003


Old Synopsis: internal error: Segmentation fault using std::vector with "-pedantic -Wunreachable-code"
New Synopsis: [3.3/3.4 regression] Seg fault with "-pedantic -Wunreachable-code"

Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-By: bangerth
Responsible-Changed-When: Mon Apr 14 17:04:22 2003
Responsible-Changed-Why:
    Likely associated with a patch that led to this
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Mon Apr 14 17:04:22 2003
State-Changed-Why:
    [Gaby, I add you to the list of listeners to this report,
    since it may be a 3.2 branch regression for
    - C++ standard headers
    - a common combination of flags.]
    
    Confirmed. Here's a redux:
    -----------------
    template <typename T>
    struct X {
        X() throw() {}
    };
    template class X<int>;
    -------------------------
    g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -pedantic -Wunreachable-code -c y.cc
    y.cc: In constructor `X<T>::X() [with T = int]':
    y.cc:3:   instantiated from `X<T>::X() [with T = int]'
    y.cc:5:   instantiated from here
    y.cc:3: internal compiler error: Segmentation fault
    
    It fails with both 3.3 and mainline (3.4). I doesn't fail
    with the lates 3.2.3pre I have on my disk, which is
    2003-03-29, but according to the submitter it also fails
    on this branch. Since the code in question is in a standard
    header and the flags used are a rather usual combination,
    this is a quite severe combination.
    
    On mainline, here's a backtrace:
    #0  never_reached_warning (avoided_insn=0x40180c34, finish=0x40180c34)
        at ../../gcc-3.4-CVS/gcc/jump.c:1916
    #1  0x08189b7c in flow_delete_block_noexpunge (b=0x85d1ae0)
        at ../../gcc-3.4-CVS/gcc/cfgrtl.c:379
    #2  0x08189c57 in flow_delete_block (b=0x85d1ae0)
        at ../../gcc-3.4-CVS/gcc/cfgrtl.c:415
    #3  0x083d01eb in try_optimize_cfg (mode=16)
        at ../../gcc-3.4-CVS/gcc/cfgcleanup.c:1775
    #4  0x083d05bc in cleanup_cfg (mode=16)
        at ../../gcc-3.4-CVS/gcc/cfgcleanup.c:1930
    
    It fails in this code
      /* Back up to the first of any NOTEs preceding avoided_insn; flow passes
         us the head of a block, a NOTE_INSN_BASIC_BLOCK, which often follows
         the line note.  */
      for (insn = PREV_INSN (avoided_insn); ; insn = PREV_INSN (insn))
        if (GET_CODE (insn) != NOTE)
          {
    	insn = NEXT_INSN (insn);
    	break;
          }
    since insn==NULL, which doesn't play nice in the GET_CODE.
    This code was added by Jason in 1.221 here:
    revision 1.221
    date: 2003/04/04 01:21:56;  author: jason;  state: Exp;  lines: +12 -2
            PR c/10175
            * jump.c (never_reached_warning): Revert patch of 2002-11-02.
            Look backwards for a line note.
    
    This patch also appears on the 3.2 branch. Jason, can you
    take a look what happens here?
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10401



More information about the Gcc-bugs mailing list