From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3985 invoked by alias); 19 May 2003 18:16:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3959 invoked by uid 71); 19 May 2003 18:16:01 -0000 Date: Mon, 19 May 2003 18:16:00 -0000 Message-ID: <20030519181601.3956.qmail@sources.redhat.com> To: law@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: law@redhat.com Subject: Re: optimization/10862: [tree-ssa] Segfault for (essentially) empty function Reply-To: law@redhat.com X-SW-Source: 2003-05/txt/msg02103.txt.bz2 List-Id: The following reply was made to PR optimization/10862; it has been noted by GNATS. From: law@redhat.com To: bangerth@dealii.org Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: optimization/10862: [tree-ssa] Segfault for (essentially) empty function Date: Mon, 19 May 2003 12:12:35 -0600 In message <20030519144341.25098.qmail@sources.redhat.com>, bangerth@dealii.org writes: > >>Number: 10862 >>Category: optimization >>Synopsis: [tree-ssa] Segfault for (essentially) empty function >>Confidential: no >>Severity: serious >>Priority: medium >>Responsible: unassigned >>State: open >>Class: sw-bug >>Submitter-Id: net >>Arrival-Date: Mon May 19 14:46:01 UTC 2003 >>Closed-Date: >>Last-Modified: >>Originator: Wolfgang Bangerth >>Release: unknown-1.0 >>Organization: >>Environment: > >>Description: >This one's rather funny (and was much simpler to reduce). >We ICE on a function that's essentially empty: >---------------------------------------template void foo () { > int i; > switch (i) { > case 1: > switch (N) {} > default: ; > } >} > >template void foo<1> (); >--------------------------- > >g/x> /home/bangerth/bin/gcc-3.4-tree-ssa/bin/c++ -O2 -c a.cc >a.cc: In function `void foo() [with int N = 1]': >a.cc:10: instantiated from here >a.cc:6: internal compiler error: Segmentation fault >Please submit a full bug report, >with preprocessed source if appropriate. >See for instructions. This patch ought to fix this problem. * tree-ssa-dce.c (remove_conditional): If the conditional's block has no post dominator in the CFG, then wire it to the exit node. Avoid unnecessary check of bb->succ. Index: tree-ssa-dce.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dce.c,v retrieving revision 1.1.2.37 diff -c -3 -p -r1.1.2.37 tree-ssa-dce.c *** tree-ssa-dce.c 16 May 2003 18:09:19 -0000 1.1.2.37 --- tree-ssa-dce.c 19 May 2003 16:50:25 -0000 *************** remove_conditional (basic_block bb) *** 627,632 **** --- 627,637 ---- if (bb->succ) return; + /* If there is no post dominator, then this block is going to the + exit node. */ + if (pdom_bb == NULL) + pdom_bb = EXIT_BLOCK_PTR; + /* If the post dominator has any PHI nodes in it at all, the conditional has been marked as necessary. This means no PHI node updating is required. If there are any PHI nodes, its a bug *************** remove_conditional (basic_block bb) *** 642,647 **** #endif /* Add an edge to BB's post dominator. */ ! if (bb->succ == NULL) ! make_edge (bb, pdom_bb, EDGE_FALLTHRU); } --- 647,651 ---- #endif /* Add an edge to BB's post dominator. */ ! make_edge (bb, pdom_bb, EDGE_FALLTHRU); }