Bug 32325 - [4.3 Regression] cc1plus ICE configuring libstdc++ on Tru64 UNIX V5.1B: SEGV in rtl_verify_flow_info
Summary: [4.3 Regression] cc1plus ICE configuring libstdc++ on Tru64 UNIX V5.1B: SEGV ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P2 normal
Target Milestone: 4.3.0
Assignee: Eric Botcazou
URL:
Keywords: build, ice-on-valid-code
: 33545 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-13 18:04 UTC by Rainer Orth
Modified: 2007-10-13 04:14 UTC (History)
3 users (show)

See Also:
Host: alpha-dec-osf5.1b
Target: alpha-dec-osf5.1b
Build: alpha-dec-osf5.1b
Known to work:
Known to fail:
Last reconfirmed: 2007-09-20 20:46:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2007-06-13 18:04:03 UTC
During a mainline bootstrap on alpha-dec-osf5.1b, the libstdc++ configure
failed:

checking for exception model to use... configure: error: unable to detect exception model
make[1]: *** [configure-target-libstdc++-v3] Error 1

config.log reveals:

configure:13794: checking for exception model to use
configure:13838:  /vol/gccsrc/obj/gcc-4.3.0-20070612/5.1b-gcc/./gcc/xgcc -shared-libgcc -B/vol/gccsrc/obj/gcc-4.3.0-20070612/5.1b-gcc/./gcc -nostdinc++ -L/vol/gccsrc/obj/gcc-4.3.0-20070612/5.1b-gcc/alpha-dec-osf5.1b/libstdc++-v3/src -L/vol/gccsrc/obj/gcc-4.3.0-20070612/5.1b-gcc/alpha-dec-osf5.1b/libstdc++-v3/src/.libs -B/vol/gcc/alpha-dec-osf5.1b/bin/ -B/vol/gcc/alpha-dec-osf5.1b/lib/ -isystem /vol/gcc/alpha-dec-osf5.1b/include -isystem /vol/gcc/alpha-dec-osf5.1b/sys-include -c -S  conftest.cc >&5
configure: In function 'void foo()':
configure:13836: error: end insn 27 for block 7 not found in the insn stream
configure:13836: error: head insn 24 for block 7 not found in the insn stream
configure:13836: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
configure:13841: $? = 1
configure:13870: error: unable to detect exception model

This happens with the following conftest.cc:

struct S { ~S(); };
void bar();
void foo()
{
  S s;
  bar();
}

 % ./cc1plus conftest.cc
 void foo()
Analyzing compilation unit
Performing interprocedural optimizations
 <visibility> <early_local_cleanups> <inline>Assembling functions:
 void foo()
conftest.cc: In function 'void foo()':
conftest.cc:7: error: end insn 27 for block 7 not found in the insn stream
conftest.cc:7: error: head insn 24 for block 7 not found in the insn stream
conftest.cc:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Running gdb reveals

Program received signal SIGSEGV, Segmentation fault.
rtl_verify_flow_info () at /vol/gcc/src/gcc-dist/gcc/cfgrtl.c:2005
(gdb) where
#0  rtl_verify_flow_info () at /vol/gcc/src/gcc-dist/gcc/cfgrtl.c:2005
#1  0x0000000120516638 in verify_flow_info () at /vol/gcc/src/gcc-dist/gcc/cfghooks.c:245
#2  0x0000000120618934 in commit_edge_insertions () at /vol/gcc/src/gcc-dist/gcc/cfgrtl.c:1467
#3  0x0000000120415bcc in alpha_gp_save_rtx () at /vol/gcc/src/gcc-dist/gcc/config/alpha/alpha.c:4784
#4  0x00000001206406fc in gen_exception_receiver () at /vol/gcc/src/gcc-dist/gcc/config/alpha/alpha.md:7019
#5  0x0000000120314dc8 in finish_eh_generation () at /vol/gcc/src/gcc-dist/gcc/except.c:1633
#6  0x0000000120314f98 in rest_of_handle_eh () at /vol/gcc/src/gcc-dist/gcc/except.c:3985
#7  0x0000000120421978 in execute_one_pass (pass=0x0) at /vol/gcc/src/gcc-dist/gcc/passes.c:1124
#8  0x0000000120421c48 in execute_pass_list (pass=0x0) at /vol/gcc/src/gcc-dist/gcc/passes.c:1177
#9  0x0000000120421c5c in execute_pass_list (pass=0x0) at /vol/gcc/src/gcc-dist/gcc/passes.c:1178
#10 0x00000001204fef44 in tree_rest_of_compilation (fndecl=0x0) at /vol/gcc/src/gcc-dist/gcc/tree-optimize.c:406
#11 0x00000001202535c8 in c_expand_body (fndecl=0x140137d80) at /vol/gcc/src/gcc-dist/gcc/c-common.c:4331
#12 0x00000001201ea958 in expand_body (fn=0x18de60) at /vol/gcc/src/gcc-dist/gcc/cp/semantics.c:3136
#13 0x0000000120423f60 in cgraph_expand_function (node=0x18de60) at /vol/gcc/src/gcc-dist/gcc/cgraphunit.c:1073
#14 0x0000000120427400 in cgraph_optimize () at /vol/gcc/src/gcc-dist/gcc/cgraphunit.c:1142
#15 0x000000012015e054 in cp_write_global_declarations () at /vol/gcc/src/gcc-dist/gcc/cp/decl2.c:3305
#16 0x00000001204432e0 in toplev_main (argc=1, argv=0x0) at /vol/gcc/src/gcc-dist/gcc/toplev.c:1064
#17 0x000000012029fe98 in main (argc=1075019136, argv=0x11fffbb30) at /vol/gcc/src/gcc-dist/gcc/main.c:35
(gdb) p x
$1 = 0x0

I.e. rtl_verify_flow_info dereferences a NULL pointer.  This happens only
on alpha-dec-osf5.1b, alpha-dec-osf4.0f is unaffected.

Environment:
System: OSF1 bartok V5.1 2650 alpha
Machine: alpha
	
host: alpha-dec-osf5.1b
build: alpha-dec-osf5.1b
target: alpha-dec-osf5.1b
configured with: /vol/gcc/src/gcc-dist/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls --host alpha-dec-osf5.1b --build alpha-dec-osf5.1b --target alpha-dec-osf5.1b --with-gmp=/vol/gcc --with-mpfr=/vol/gcc --enable-languages=c,c++,fortran,java,objc,ada --disable-libmudflap

How-To-Repeat:
Bootstrap as described above.
Comment 1 Rainer Orth 2007-09-20 14:17:00 UTC
Subject: Re:  [4.3 Regression] cc1plus ICE configuring libstdc++ on Tru64 UNIX V5.1B: SEGV in rtl_verify_flow_info

A reghunt revealed that this was caused by the following patch:

2007-03-02  Eric Botcazou  <ebotcazou@adacore.com>

        * config/alpha/alpha.c (alpha_gp_save_rtx): Insert the insns at the
        entry by means of emit_insn_at_entry.

Since alpha_gp_save_rtx is only used with TARGET_LD_BUGGY_LDGP, which is
only defined in osf5.h, alpha-dec-osf5.1b is affected while
alpha-dec-osf4.0f is not.

	Rainer
Comment 2 Eric Botcazou 2007-09-20 20:45:57 UTC
> A reghunt revealed that this was caused by the following patch:
> 
> 2007-03-02  Eric Botcazou  <ebotcazou@adacore.com>
> 
>         * config/alpha/alpha.c (alpha_gp_save_rtx): Insert the insns at the
>         entry by means of emit_insn_at_entry.

Right.  Interestingly enough, this is purely a checking failure, i.e. the IL
is correct at the end of the pass.  What happens is that in

  if (USING_SJLJ_EXCEPTIONS)
    sjlj_build_landing_pads ();
  else
    dw2_build_landing_pads ();

  cfun->eh->built_landing_pads = 1;

  /* We've totally changed the CFG.  Start over.  */
  find_exception_handler_labels ();
  break_superblocks ();
  if (USING_SJLJ_EXCEPTIONS)
    commit_edge_insertions ();

dw2_build_landing_pads will trigger a CFG verification, which of course is
not the right thing to do given the comment in the code.

The solution is the original patch I posted:
  http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01448.html
which was OKed by RTH:
  http://gcc.gnu.org/ml/gcc-patches/2007-02/msg01162.html
so I'm going to apply it.
Comment 3 Eric Botcazou 2007-09-20 20:46:14 UTC
Fixing.
Comment 4 Eric Botcazou 2007-09-20 20:48:18 UTC
Btw, Rainer, would you know whether TARGET_LD_BUGGY_LDGP is still relevant?
Comment 5 Eric Botcazou 2007-09-22 08:43:07 UTC
Subject: Bug 32325

Author: ebotcazou
Date: Sat Sep 22 08:42:57 2007
New Revision: 128665

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128665
Log:
	PR target/32325
	* except.c (finish_eh_generation): Call commit_edge_insertions if
	there are insns queued on the entry edge.
	* config/alpha/alpha.c (alpha_gp_save_rtx): Insert the insns on
	the entry edge.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/alpha/alpha.c
    trunk/gcc/except.c

Comment 6 Eric Botcazou 2007-09-22 08:46:18 UTC
Note that libstdc++-v3 didn't build for me without a kludge for EOVERFLOW.
Comment 7 roger 2007-10-13 04:14:23 UTC
*** Bug 33545 has been marked as a duplicate of this bug. ***