public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault
@ 2004-08-16  1:59 danglin at gcc dot gnu dot org
  2004-08-16  2:03 ` [Bug middle-end/17044] [3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: danglin at gcc dot gnu dot org @ 2004-08-16  1:59 UTC (permalink / raw)
  To: gcc-bugs

./xgcc -B./ -B/opt/gnu64/gcc/gcc-3.5.0/hppa64-hp-hpux11.11/bin/ -isystem /opt/gn
u64/gcc/gcc-3.5.0/hppa64-hp-hpux11.11/include -isystem /opt/gnu64/gcc/gcc-3.5.0/
hppa64-hp-hpux11.11/sys-include -L/xxx/gnu/gcc-3.3/objdir/gcc/../ld -O2  -DIN_GC
C    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-sty
le-definition  -isystem ./include  -fPIC -Dpa64=1 -DELF=1 -mlong-calls -g -DHAVE
_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../gcc/gcc -I.
./../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I..
/../gcc/gcc/../libbanshee/libcompat -I../../gcc/gcc/../libbanshee -I../../gcc/gc
c/../libbanshee/points-to  -DL_absvsi2 -c ../../gcc/gcc/libgcc2.c -o libgcc/./_a
bsvsi2.o
../../gcc/gcc/libgcc2.c: In function `__absvsi2':
../../gcc/gcc/libgcc2.c:169: internal compiler error: Segmentation fault

This problem appears to have been introduced by a series of changes by Paolo 
Bonzini on 2004-08-09.  It appears this change removed active code:

2004-08-09  Paolo Bonzini  <bonzini@gnu.org>

        * expr.c (var_rtx): Remove.
        (expand_expr_real_1) <LOOP_EXPR, EXIT_EXPR,
        LABELED_BLOCK_EXPR, EXIT_BLOCK_EXPR, TRUTH_ANDIF_EXPR,
        TRUTH_ORIF_EXPR, COMPOUND_EXPR, CONJ_EXPR, INIT_EXPR>:
        Abort.
        (expand_expr_real_1) <COND_EXPR>: Remove most special cases.
        * optabs.c (emit_clr_insn, emit_0_to_1_insn): Remove.
        * optabs.h (emit_clr_insn, emit_0_to_1_insn): Remove.

After this change, things failed as follows:

stage1/xgcc -Bstage1/ -B/opt/gnu64/gcc/gcc-3.5.0/hppa64-hp-hpux11.11/bin/   -g -
O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Werror -fn
o-common   -DHAVE_CONFIG_H -DGENERATOR_FILE  -o genmodes \
 genmodes.o errors.o ../libiberty/libiberty.a
./genmodes -h > tmp-modes.h
./genmodes: machmode.def:187: duplicate definition of mode "TC"
./genmodes: config/pa/pa-modes.def:28: previous definition here
./genmodes: machmode.def:187: duplicate definition of mode "DC"
./genmodes: machmode.def:150: previous definition here
./genmodes: machmode.def:150: (BLK) field component must not be set
./genmodes: config/pa/pa-modes.def:28: (CCFP) field component must not be set

After this change, things are broken:

2004-08-09  Paolo Bonzini  <bonzini@gnu.org>

        * expr.c (expand_expr_real_1): Add back code that was not dead.

The problem seems like a garbage collection issue (i.e., we seem to be
freeing a page twice).  Thus, it might be the following change is the
real culprit:

2004-08-09  Geoffrey Keating  <geoffk@apple.com>

        * ggc-common.c (ggc_rlimit_bound): Don't check RSS limit.
        Check DATA limit only if there's no AS limit.  Ignore insanely
        low DATA limits.
        (ggc_min_heapsize_heuristic): Don't divide AS or RSS limits by 8,
        but take care that the AS limit isn't overrun.
        * doc/invoke.texi: Update documentation of min-heapsize parameter.

-- 
           Summary: libgcc2.c:169: internal compiler error: Segmentation
                    fault
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: danglin at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: hppa64-hp-hpux11.11
  GCC host triplet: hppa64-hp-hpux11.11
GCC target triplet: hppa64-hp-hpux11.11


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
@ 2004-08-16  2:03 ` pinskia at gcc dot gnu dot org
  2004-08-16  2:11 ` dave at hiauly1 dot hia dot nrc dot ca
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-16  2:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-16 02:03 -------
Note I doubt that Geoff's change causes this unless it was a latent bug.

The problem is most likely Paolo removed too much code even after putting back the code which fixes 
powerpc-apple-darwin

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org
           Keywords|                            |build, ice-on-valid-code
            Summary|libgcc2.c:169: internal     |[3.5 Regression]
                   |compiler error: Segmentation|libgcc2.c:169: internal
                   |fault                       |compiler error: Segmentation
                   |                            |fault
   Target Milestone|---                         |3.5.0


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
  2004-08-16  2:03 ` [Bug middle-end/17044] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-08-16  2:11 ` dave at hiauly1 dot hia dot nrc dot ca
  2004-08-16  4:18 ` danglin at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2004-08-16  2:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-16 02:11 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169: internal c

> Note I doubt that Geoff's change causes this unless it was a latent bug.
> 
> The problem is most likely Paolo removed too much code even after putting
> back the code which fixes 
> powerpc-apple-darwin

I'm going to apply Paolo's patch to put back the removed code to
fix darwin just after this change:

        2004-08-09  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/wchar_t-2.c: Fix typo.

That should help isolate the problem.

Dave


-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
  2004-08-16  2:03 ` [Bug middle-end/17044] [3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-08-16  2:11 ` dave at hiauly1 dot hia dot nrc dot ca
@ 2004-08-16  4:18 ` danglin at gcc dot gnu dot org
  2004-08-16  6:07 ` law at redhat dot com
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: danglin at gcc dot gnu dot org @ 2004-08-16  4:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From danglin at gcc dot gnu dot org  2004-08-16 04:18 -------
Ok, after backporting the darwin fix, it turns out that the patch that
actually introduced the ICE noted in the summary is:

2004-08-09  Jeff Law  <law@redhat.com>

        * Makefile.in (OBJC-common): Add tree-ssa-threadupdate.c
        (tree-ssa-threadupdate.o): Add dependencies.
        * tree-ssa-threadupdate.c: New file.
        * tree-flow.h (incoming_edge_threaded): New flag in block annotation.
        (rewrite_vars_out_of_ssa): Remove prototype.
        (cleanup_tree_cfg): Returns a bool.
        * tree.h (thread_through_all_blocks): Prototype.
        * tree-outof-ssa.c  (SSANORM_*): Move into here.
        (remove_ssa_form): Now static.
        (rewrite_vars_out_of_ssa): Kill.
        * tree-ssa-live.c (register_ssa_partitions_for_vars): Kill.
        * tree-ssa-live.h (SSANORM_*): Moved into tree-outof-ssa.c.
        (remove_ssa_form, register_partitions_for_vars): Kill declarations.
        * tree-cfg.c (cleanup_tree_cfg): Return a value indicating if
        anything was changed.
        * tree-phinodes.c (add_phi_arg): Get the block for the PHI
        from the PHI's annotation rather than the edge associated with
        the new argument.
        * tree-ssa-dom.c (redirection_edges): Kill.
        (redirect_edges_and_update_ssa_graph): Kill.
        (tree_ssa_dominator_optimize): Do not reset forwardable flag
        for blocks anymore.  Do not initialize redirection_edges.
        Call thread_through_all_blocks.  Simplify code for cleanup
        of the CFG and iterating.  No longer call cleanup_tree_cfg
        outside the iteration loop.
        (thread_across_edge): No longer mess with forwardable blocks.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-08-16  4:18 ` danglin at gcc dot gnu dot org
@ 2004-08-16  6:07 ` law at redhat dot com
  2004-08-16 14:40 ` danglin at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: law at redhat dot com @ 2004-08-16  6:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2004-08-16 06:07 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169:
	internal compiler error: Segmentation fault

On Sun, 2004-08-15 at 22:18, danglin at gcc dot gnu dot org wrote:
> ------- Additional Comments From danglin at gcc dot gnu dot org  2004-08-16 04:18 -------
> Ok, after backporting the darwin fix, it turns out that the patch that
> actually introduced the ICE noted in the summary is:
> 
> 2004-08-09  Jeff Law  <law@redhat.com>
Sigh.  Can you send me a .i file so that I can take a looksie with a
cross compiler?  I won't have access to my HPs for at least another
week.

jeff




-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-08-16  6:07 ` law at redhat dot com
@ 2004-08-16 14:40 ` danglin at gcc dot gnu dot org
  2004-08-17  5:26 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: danglin at gcc dot gnu dot org @ 2004-08-16 14:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From danglin at gcc dot gnu dot org  2004-08-16 14:40 -------
Created an attachment (id=6937)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6937&action=view)
Preprocessed source (gzip'd)


-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-08-16 14:40 ` danglin at gcc dot gnu dot org
@ 2004-08-17  5:26 ` pinskia at gcc dot gnu dot org
  2004-08-17  5:44 ` law at redhat dot com
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-17  5:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-17 05:26 -------
hmm, I cannot reproduce this with a cross compiler, what stage is this from?

Or is this error you said which happened (if so this is a much harder problem).

-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-08-17  5:26 ` pinskia at gcc dot gnu dot org
@ 2004-08-17  5:44 ` law at redhat dot com
  2004-08-17 16:27 ` dave at hiauly1 dot hia dot nrc dot ca
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: law at redhat dot com @ 2004-08-17  5:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2004-08-17 05:44 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169:
	internal compiler error: Segmentation fault

On Mon, 2004-08-16 at 23:26, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-17 05:26 -------
> hmm, I cannot reproduce this with a cross compiler,
Neither could I.


>  what stage is this from?
Probably a good place to start ;-)


John -- if this is a problem building libgcc2.i with the stage1
compiler, can you send me a backtrace at the failure point (again,
I'm without access to my HPs for at least a week).

Thanks,
Jeff



-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-08-17  5:44 ` law at redhat dot com
@ 2004-08-17 16:27 ` dave at hiauly1 dot hia dot nrc dot ca
  2004-08-17 17:38 ` dave at hiauly1 dot hia dot nrc dot ca
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2004-08-17 16:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-17 16:27 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169: internal c

> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-17
> 05:26 -------
> hmm, I cannot reproduce this with a cross compiler, what stage is this from?

Stage 1 built with 3.4.0.  The CVS tag is D2004.08.09.19.14.00.  The following
fix is added to the tree:

2004-08-09  Paolo Bonzini  <bonzini@gnu.org>

        * expr.c (expand_expr_real_1): Add back code that was not dead.

I'm working on getting a backtrace but gdb is somewhat broken and
can't generate the backtrace.

Dave


-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-08-17 16:27 ` dave at hiauly1 dot hia dot nrc dot ca
@ 2004-08-17 17:38 ` dave at hiauly1 dot hia dot nrc dot ca
  2004-08-17 20:49 ` dave at hiauly1 dot hia dot nrc dot ca
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2004-08-17 17:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-17 17:38 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169: internal c

> John -- if this is a problem building libgcc2.i with the stage1
> compiler, can you send me a backtrace at the failure point (again,
> I'm without access to my HPs for at least a week).

The exception occurs in the following call to free:

Breakpoint 13, 0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
    at ../../gcc/gcc/tree-ssa-threadupdate.c:381
381           free (rd);
(gdb) bt
#0  0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
    at ../../gcc/gcc/tree-ssa-threadupdate.c:381
#1  0x400000000031e418 in thread_through_all_blocks ()
    at ../../gcc/gcc/tree-ssa-threadupdate.c:415
#2  0x40000000002daeb4 in tree_ssa_dominator_optimize ()
    at ../../gcc/gcc/tree-ssa-dom.c:365
#3  0x40000000002205ac in execute_one_pass (pass=0x8000000100000f38)
    at ../../gcc/gcc/tree-optimize.c:453
#4  0x40000000002206d8 in execute_pass_list (pass=0x8000000100000f38)
    at ../../gcc/gcc/tree-optimize.c:478
#5  0x4000000000220718 in execute_pass_list (pass=0x8000000100000950)
    at ../../gcc/gcc/tree-optimize.c:479
#6  0x4000000000220b74 in tree_rest_of_compilation (
    fndecl=0x800003fffeaf3000, nested_p=0 '\0')
    at ../../gcc/gcc/tree-optimize.c:556
#7  0x40000000001285a4 in c_expand_body (fndecl=0x800003fffeaf3000)
    at ../../gcc/gcc/c-decl.c:6397
#8  0x40000000007f60c8 in cgraph_expand_function (node=0x800003fffeac6b60)
    at ../../gcc/gcc/cgraphunit.c:801
#9  0x40000000007f99c4 in cgraph_expand_all_functions ()
    at ../../gcc/gcc/cgraphunit.c:1673
#10 0x40000000007f9f8c in cgraph_optimize ()
    at ../../gcc/gcc/cgraphunit.c:1763
#11 0x4000000000129a78 in c_write_global_declarations ()
    at ../../gcc/gcc/c-decl.c:6711
#12 0x4000000000734940 in compile_file () at ../../gcc/gcc/toplev.c:989
#13 0x4000000000738194 in do_compile () at ../../gcc/gcc/toplev.c:2060
#14 0x40000000007382a8 in toplev_main (argc=45, argv=0x800003fffeff0830)
    at ../../gcc/gcc/toplev.c:2092
#15 0x40000000001d467c in main (argc=-2147482625, argv=0x800003fffeac85a0)
    at ../../gcc/gcc/main.c:35

Dave


-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-08-17 17:38 ` dave at hiauly1 dot hia dot nrc dot ca
@ 2004-08-17 20:49 ` dave at hiauly1 dot hia dot nrc dot ca
  2004-08-18 15:36 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2004-08-17 20:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-17 20:49 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169: internal c

> The exception occurs in the following call to free:
> 
> Breakpoint 13, 0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
>     at ../../gcc/gcc/tree-ssa-threadupdate.c:381
> 381           free (rd);

Here is a possible fix.  VARRAY_GENERIC_PTR_INIT allocates with
garbage collection enabled.  The code as written was trying to
free the i=0 block allocated using ggc_alloc (i.e., mmap allocated).
This patch leaves collection to the garbage collector.

I will post to gcc-patches when testing completes.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2004-08-17  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle-end/17044
	* tree-ssa-threadupdate.c (redirection_data): Make static.
	(thread_block): Use ggc_alloc_cleared to allocate struct
	redirection_data.  Don't free elements in redirection_data.

Index: tree-ssa-threadupdate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-threadupdate.c,v
retrieving revision 2.1
diff -u -3 -p -r2.1 tree-ssa-threadupdate.c
--- tree-ssa-threadupdate.c	9 Aug 2004 19:13:07 -0000	2.1
+++ tree-ssa-threadupdate.c	17 Aug 2004 20:15:35 -0000
@@ -92,6 +92,9 @@ struct redirection_data
   edge outgoing_edge;
 };
 
+/* Main data structure to hold information for duplicates of BB.  */
+static varray_type redirection_data;
+
 /* For each PHI node in BB, find or create a PHI node in NEW_BB for the
    same PHI_RESULT.  Add an argument to the PHI node in NEW_BB which
    corresponds to the same PHI argument associated with edge E in BB.  */
@@ -239,8 +242,6 @@ thread_block (basic_block bb)
      be threaded to a duplicate of BB.  */
   bool all = true;
 
-  /* Main data structure to hold information for duplicates of BB.  */
-  varray_type redirection_data;
   unsigned int i;
 
   VARRAY_GENERIC_PTR_INIT (redirection_data, 2, "redirection data");
@@ -278,7 +279,7 @@ thread_block (basic_block bb)
 	    {
 	      struct redirection_data *rd;
 
-	      rd = xcalloc (1, sizeof (redirection_data));
+	      rd = ggc_alloc_cleared (sizeof (struct redirection_data));
 	      rd->outgoing_edge = e->aux;
 	      VARRAY_PUSH_GENERIC_PTR (redirection_data, rd);
 	    }
@@ -372,14 +373,7 @@ thread_block (basic_block bb)
       remove_last_stmt_and_useless_edges (bb, rd->outgoing_edge->dest);
     }
 
-  /* Done with this block.  Free any memory we have allocated, clear
-     REDIRECTION_DATA and unmark this block as needing incoming
-     edge redirections.  */
-  for (i = 0; i < VARRAY_ACTIVE_SIZE (redirection_data); i++)
-    {
-      struct redirection_data *rd = VARRAY_GENERIC_PTR (redirection_data, i);
-      free (rd);
-    }
+  /* Done with this block.  Clear REDIRECTION_DATA.  */
   VARRAY_CLEAR (redirection_data);
 }
 


-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2004-08-17 20:49 ` dave at hiauly1 dot hia dot nrc dot ca
@ 2004-08-18 15:36 ` pinskia at gcc dot gnu dot org
  2004-08-24 19:48 ` law at redhat dot com
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-18 15:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-18 15:36 -------
I think this can be confirmed then because the source is definitely wrong.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-18 15:36:17
               date|                            |


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2004-08-18 15:36 ` pinskia at gcc dot gnu dot org
@ 2004-08-24 19:48 ` law at redhat dot com
  2004-08-24 20:00 ` dave at hiauly1 dot hia dot nrc dot ca
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: law at redhat dot com @ 2004-08-24 19:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2004-08-24 19:48 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169:
	internal compiler error: Segmentation fault

On Tue, 2004-08-17 at 11:38, dave at hiauly1 dot hia dot nrc dot ca
wrote:
> ------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-17 17:38 -------
> Subject: Re:  [3.5 Regression] libgcc2.c:169: internal c
> 
> > John -- if this is a problem building libgcc2.i with the stage1
> > compiler, can you send me a backtrace at the failure point (again,
> > I'm without access to my HPs for at least a week).
> 
> The exception occurs in the following call to free:
> 
> Breakpoint 13, 0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
>     at ../../gcc/gcc/tree-ssa-threadupdate.c:381
> 381           free (rd);
> (gdb) bt
> #0  0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
>     at ../../gcc/gcc/tree-ssa-threadupdate.c:381
OK.  That means there's got to be a memory management error of some
kind.  I wonder if we're freeing GC'd memory or something stupid like
that.



Jeff



-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2004-08-24 19:48 ` law at redhat dot com
@ 2004-08-24 20:00 ` dave at hiauly1 dot hia dot nrc dot ca
  2004-08-24 20:04 ` law at redhat dot com
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia dot nrc dot ca @ 2004-08-24 20:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-24 20:00 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169: internal c

> > The exception occurs in the following call to free:
> > 
> > Breakpoint 13, 0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
> >     at ../../gcc/gcc/tree-ssa-threadupdate.c:381
> > 381           free (rd);
> > (gdb) bt
> > #0  0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
> >     at ../../gcc/gcc/tree-ssa-threadupdate.c:381
> OK.  That means there's got to be a memory management error of some
> kind.  I wonder if we're freeing GC'd memory or something stupid like
> that.

That might be the case although I didn't actually determine how the
object was created.  I know the fault occurred for i = 0 and all = false.

One problem is that the varray is a local and it's created and
managed using VARRAY macros that use GC.  There's also a missing
"struct" in the call to xcalloc.

I have an alternate fix that uses NOGC macros and VARRAY_FREE if
it's preferable to use malloc for the allocation of the varray.

Dave


-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2004-08-24 20:00 ` dave at hiauly1 dot hia dot nrc dot ca
@ 2004-08-24 20:04 ` law at redhat dot com
  2004-08-24 20:59 ` cvs-commit at gcc dot gnu dot org
  2004-08-24 21:04 ` pinskia at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: law at redhat dot com @ 2004-08-24 20:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2004-08-24 20:04 -------
Subject: Re:  [3.5 Regression] libgcc2.c:169:
	internal compiler error: Segmentation fault

On Tue, 2004-08-24 at 14:00, dave at hiauly1 dot hia dot nrc dot ca
wrote:
> ------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-08-24 20:00 -------
> Subject: Re:  [3.5 Regression] libgcc2.c:169: internal c
> 
> > > The exception occurs in the following call to free:
> > > 
> > > Breakpoint 13, 0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
> > >     at ../../gcc/gcc/tree-ssa-threadupdate.c:381
> > > 381           free (rd);
> > > (gdb) bt
> > > #0  0x400000000031e350 in thread_block (bb=0x800003fffeacd8c0)
> > >     at ../../gcc/gcc/tree-ssa-threadupdate.c:381
> > OK.  That means there's got to be a memory management error of some
> > kind.  I wonder if we're freeing GC'd memory or something stupid like
> > that.
> 
> That might be the case although I didn't actually determine how the
> object was created.  I know the fault occurred for i = 0 and all = false.
> 
> One problem is that the varray is a local and it's created and
> managed using VARRAY macros that use GC.  There's also a missing
> "struct" in the call to xcalloc.
> 
> I have an alternate fix that uses NOGC macros and VARRAY_FREE if
> it's preferable to use malloc for the allocation of the varray.
Let's go with your original fix -- I really dislike the NOGC stuff.

jeff
> 



-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2004-08-24 20:04 ` law at redhat dot com
@ 2004-08-24 20:59 ` cvs-commit at gcc dot gnu dot org
  2004-08-24 21:04 ` pinskia at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-24 20:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-24 20:59 -------
Subject: Bug 17044

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	danglin@gcc.gnu.org	2004-08-24 20:59:34

Modified files:
	gcc            : ChangeLog tree-ssa-threadupdate.c 

Log message:
	PR middle-end/17044
	* tree-ssa-threadupdate.c (redirection_data): Make static.
	(thread_block): Use ggc_alloc_cleared to allocate struct
	redirection_data.  Don't free elements in redirection_data.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5072&r2=2.5073
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-threadupdate.c.diff?cvsroot=gcc&r1=2.1&r2=2.2



-- 


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug middle-end/17044] [3.5 Regression] libgcc2.c:169: internal compiler error: Segmentation fault
  2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2004-08-24 20:59 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-24 21:04 ` pinskia at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 21:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 21:04 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2004-08-24 21:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-16  1:59 [Bug middle-end/17044] New: libgcc2.c:169: internal compiler error: Segmentation fault danglin at gcc dot gnu dot org
2004-08-16  2:03 ` [Bug middle-end/17044] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-08-16  2:11 ` dave at hiauly1 dot hia dot nrc dot ca
2004-08-16  4:18 ` danglin at gcc dot gnu dot org
2004-08-16  6:07 ` law at redhat dot com
2004-08-16 14:40 ` danglin at gcc dot gnu dot org
2004-08-17  5:26 ` pinskia at gcc dot gnu dot org
2004-08-17  5:44 ` law at redhat dot com
2004-08-17 16:27 ` dave at hiauly1 dot hia dot nrc dot ca
2004-08-17 17:38 ` dave at hiauly1 dot hia dot nrc dot ca
2004-08-17 20:49 ` dave at hiauly1 dot hia dot nrc dot ca
2004-08-18 15:36 ` pinskia at gcc dot gnu dot org
2004-08-24 19:48 ` law at redhat dot com
2004-08-24 20:00 ` dave at hiauly1 dot hia dot nrc dot ca
2004-08-24 20:04 ` law at redhat dot com
2004-08-24 20:59 ` cvs-commit at gcc dot gnu dot org
2004-08-24 21:04 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).