public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
@ 2007-11-21 9:18 tbm at cyrius dot com
2007-11-21 9:19 ` [Bug rtl-optimization/34171] " tbm at cyrius dot com
` (20 more replies)
0 siblings, 21 replies; 22+ messages in thread
From: tbm at cyrius dot com @ 2007-11-21 9:18 UTC (permalink / raw)
To: gcc-bugs
With current trunk on Alpha with -O3:
(sid)170:tbm@vorpal: ~] /usr/lib/gcc-snapshot/bin/gcc -O3
enlightenment-handlers.c
enlightenment-handlers.c: In function 'doSignalsSetup':
enlightenment-handlers.c:24: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
--
Summary: [4.3 Regression] Segfault in df_chain_remove_problem
with -O3 on alpha
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tbm at cyrius dot com
GCC target triplet: alpha-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
@ 2007-11-21 9:19 ` tbm at cyrius dot com
2007-11-21 9:20 ` tbm at cyrius dot com
` (19 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: tbm at cyrius dot com @ 2007-11-21 9:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tbm at cyrius dot com 2007-11-21 09:19 -------
Program received signal SIGSEGV, Segmentation fault.
df_chain_remove_problem () at gcc/df-problems.c:1948
1948 for (use_rec = df_get_artificial_uses (bb->index); *use_rec;
use_rec++)
(gdb) where
#0 df_chain_remove_problem () at gcc/df-problems.c:1948
#1 0x00000001201466fc in df_chain_fully_remove_problem ()
at gcc/df-problems.c:1981
#2 0x000000012013e3e8 in df_finish_pass (verify=0 '\0') at gcc/df-core.c:663
#3 0x00000001202e3a78 in execute_todo (flags=132097) at gcc/passes.c:1015
#4 0x00000001202e4230 in execute_one_pass (pass=0x1208c5e28)
at gcc/passes.c:1140
#5 0x00000001202e4488 in execute_pass_list (pass=0x1208c5e28)
at gcc/passes.c:1171
#6 0x00000001202e449c in execute_pass_list (pass=0x1208c25d8)
at gcc/passes.c:1172
#7 0x00000001203fc414 in tree_rest_of_compilation (fndecl=0x200004a6c30)
at gcc/tree-optimize.c:404
#8 0x00000001205f77c8 in cgraph_expand_function (node=0x200003e6500)
at gcc/cgraphunit.c:1151
#9 0x00000001205fab20 in cgraph_optimize () at gcc/cgraphunit.c:1214
#10 0x000000012001ad58 in c_write_global_declarations () at gcc/c-decl.c:8081
#11 0x0000000120381888 in toplev_main (argc=<value optimized out>, argv=<value
optimized out>) at gcc/toplev.c:1055
#12 0x00000001200afa58 in main (argc=2550688, argv=0x0) at gcc/main.c:35
(gdb)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
2007-11-21 9:19 ` [Bug rtl-optimization/34171] " tbm at cyrius dot com
2007-11-21 9:20 ` tbm at cyrius dot com
@ 2007-11-21 9:20 ` tbm at cyrius dot com
2007-11-21 9:47 ` bonzini at gnu dot org
` (17 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: tbm at cyrius dot com @ 2007-11-21 9:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from tbm at cyrius dot com 2007-11-21 09:20 -------
/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
extern char coredump;
extern void sigemptyset (char *);
struct sigaction
{
char sa_mask;
};
void doSignalsSetup (void)
{
static const int signals[] = {
1, 2, 3, 4, 6, 8, 11, 13, 14, 15, 30 , 31
};
unsigned int i, sig;
struct sigaction sa;
for (i = 0; i < sizeof (signals) / sizeof (int); i++)
{
sig = signals[i];
if (coredump &&
(sig == 4 || sig == 8 || sig == 11 || sig == 10))
continue;
sigemptyset (&sa.sa_mask);
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
2007-11-21 9:19 ` [Bug rtl-optimization/34171] " tbm at cyrius dot com
@ 2007-11-21 9:20 ` tbm at cyrius dot com
2007-11-21 9:20 ` tbm at cyrius dot com
` (18 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: tbm at cyrius dot com @ 2007-11-21 9:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tbm at cyrius dot com 2007-11-21 09:19 -------
Created an attachment (id=14588)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14588&action=view)
preprocessed source
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (2 preceding siblings ...)
2007-11-21 9:20 ` tbm at cyrius dot com
@ 2007-11-21 9:47 ` bonzini at gnu dot org
2007-11-21 10:56 ` tbm at cyrius dot com
` (16 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: bonzini at gnu dot org @ 2007-11-21 9:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from bonzini at gnu dot org 2007-11-21 09:47 -------
Created an attachment (id=14589)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14589&action=view)
attempt
Can you try this patch? I don't have the resources now to build a cross and
test it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (3 preceding siblings ...)
2007-11-21 9:47 ` bonzini at gnu dot org
@ 2007-11-21 10:56 ` tbm at cyrius dot com
2007-11-21 12:52 ` paolo dot bonzini at lu dot unisi dot ch
` (15 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: tbm at cyrius dot com @ 2007-11-21 10:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from tbm at cyrius dot com 2007-11-21 10:56 -------
(In reply to comment #4)
> Created an attachment (id=14589)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14589&action=view) [edit]
> attempt
>
> Can you try this patch? I don't have the resources now to build a cross and
> test it.
Now I'm getting:
Program received signal SIGSEGV, Segmentation fault.
0x00000001201466d0 in df_chain_remove_problem () at
/home/tbm/scratch/gcc/gcc/df-problems.c:1941
1941 struct df_ref **def_rec = df_get_artificial_defs (bb->index);
(gdb) where
#0 0x00000001201466d0 in df_chain_remove_problem () at
/home/tbm/scratch/gcc/gcc/df-problems.c:1941
#1 0x00000001201469e8 in df_chain_fully_remove_problem ()
at /home/tbm/scratch/gcc/gcc/df-problems.c:1982
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (4 preceding siblings ...)
2007-11-21 10:56 ` tbm at cyrius dot com
@ 2007-11-21 12:52 ` paolo dot bonzini at lu dot unisi dot ch
2007-11-21 16:22 ` spark at gcc dot gnu dot org
` (14 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: paolo dot bonzini at lu dot unisi dot ch @ 2007-11-21 12:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot bonzini at lu dot unisi dot ch 2007-11-21 12:51 -------
Subject: Re: [4.3 Regression] Segfault in df_chain_remove_problem
with -O3 on alpha
So it means the basic block has been deleted.
I want to see what happens if I consolidate all the
out_of_date_transfer_functions bitmaps into one. Seongbae, do you
remember experimenting with anything like that?
Paolo
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (5 preceding siblings ...)
2007-11-21 12:52 ` paolo dot bonzini at lu dot unisi dot ch
@ 2007-11-21 16:22 ` spark at gcc dot gnu dot org
2007-11-21 17:47 ` steven at gcc dot gnu dot org
` (13 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-11-21 16:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from spark at gcc dot gnu dot org 2007-11-21 16:22 -------
(In reply to comment #6)
> Subject: Re: [4.3 Regression] Segfault in df_chain_remove_problem
> with -O3 on alpha
>
> So it means the basic block has been deleted.
>
> I want to see what happens if I consolidate all the
> out_of_date_transfer_functions bitmaps into one. Seongbae, do you
> remember experimenting with anything like that?
>
> Paolo
Not really.
I agree that it's most likely a bb being deleted though.
I guess somebody will have to trace through using a debugger
I'll try to build a cross to alpha and see if I can reproduce the problem
today.
--
spark at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |spark at gcc dot gnu dot org
|dot org |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (6 preceding siblings ...)
2007-11-21 16:22 ` spark at gcc dot gnu dot org
@ 2007-11-21 17:47 ` steven at gcc dot gnu dot org
2007-11-21 18:11 ` tbm at cyrius dot com
` (12 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-11-21 17:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from steven at gcc dot gnu dot org 2007-11-21 17:47 -------
Martin, can you go up to frame #4, and do "print *pass" in gdb? Thanks.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-11-21 17:47:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (7 preceding siblings ...)
2007-11-21 17:47 ` steven at gcc dot gnu dot org
@ 2007-11-21 18:11 ` tbm at cyrius dot com
2007-11-21 20:03 ` steven at gcc dot gnu dot org
` (11 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: tbm at cyrius dot com @ 2007-11-21 18:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from tbm at cyrius dot com 2007-11-21 18:11 -------
(In reply to comment #8)
> Martin, can you go up to frame #4, and do "print *pass" in gdb? Thanks.
You mean in execute_one_pass, right?
Breakpoint 4, execute_one_pass (pass=0x1208c51b8) at gcc/passes.c:1065
1065 current_pass = pass;
(gdb) print *pass
$1 = {name = 0x1207c2e7e "useless", gate = 0,
execute = 0x1203a57a0 <remove_useless_stmts>,
sub = 0x0, next = 0x120896890, static_pass_number = 12,
tv_id = 0, properties_required = 1,
properties_provided = 0, properties_destroyed = 0,
todo_flags_start = 589824,
todo_flags_finish = 1, letter = 0 '\0'}
(gdb)
(gdb) c
Continuing.
Breakpoint 3, execute_one_pass (pass=0x1208c51b8) at gcc/passes.c:1140
1140 execute_todo (todo_after | pass->todo_flags_finish);
(gdb) print *pass
$2 = {name = 0x1207c2e7e "useless", gate = 0,
execute = 0x1203a57a0 <remove_useless_stmts>,
sub = 0x0, next = 0x120896890, static_pass_number = 12,
tv_id = 0, properties_required = 1,
properties_provided = 0, properties_destroyed = 0,
todo_flags_start = 589824,
todo_flags_finish = 1, letter = 0 '\0'}
(gdb)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (8 preceding siblings ...)
2007-11-21 18:11 ` tbm at cyrius dot com
@ 2007-11-21 20:03 ` steven at gcc dot gnu dot org
2007-11-21 20:23 ` tbm at cyrius dot com
` (10 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-11-21 20:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from steven at gcc dot gnu dot org 2007-11-21 20:02 -------
That is useless information. You have a breakpoint on execute_one_pass, which
executes the pass list.
Look at *pass _at the point of the ICE_.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (9 preceding siblings ...)
2007-11-21 20:03 ` steven at gcc dot gnu dot org
@ 2007-11-21 20:23 ` tbm at cyrius dot com
2007-11-21 20:41 ` spark at gcc dot gnu dot org
` (9 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: tbm at cyrius dot com @ 2007-11-21 20:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from tbm at cyrius dot com 2007-11-21 20:23 -------
(In reply to comment #10)
> That is useless information. You have a breakpoint on execute_one_pass, which
> executes the pass list.
I thought you said frame 4 and that was execute_one_pass. Anyway, Seongbae
Park found the problem in the meantime so I guess he'll add more info soon.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (10 preceding siblings ...)
2007-11-21 20:23 ` tbm at cyrius dot com
@ 2007-11-21 20:41 ` spark at gcc dot gnu dot org
2007-11-21 22:09 ` spark at gcc dot gnu dot org
` (8 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-11-21 20:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from spark at gcc dot gnu dot org 2007-11-21 20:40 -------
At the end of fwprop2 pass in fwprop_done(), we call cleanup_cfg()
and it merges a few blocks, making some bb disappear (in this particular case,
bb index 25), which clears the bit in df_chain->out_of_date_transfer_functions.
Then, somehow, some of the insns originating from 25 has their bb numbers not
reset, and later those insns get the new bb numbers assigned, at which point we
call df_insn_change_bb(), which sets the bit for the deleted block on
out_of_date_transfer_functions map.
Then after fwprop, TODO runs df_finish_pass and we bomb.
I'm working on a fix.
--
spark at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Last reconfirmed|2007-11-21 17:47:04 |2007-11-21 20:40:45
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (11 preceding siblings ...)
2007-11-21 20:41 ` spark at gcc dot gnu dot org
@ 2007-11-21 22:09 ` spark at gcc dot gnu dot org
2007-11-21 22:30 ` steven at gcc dot gnu dot org
` (7 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-11-21 22:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from spark at gcc dot gnu dot org 2007-11-21 22:08 -------
The following patch seems to fix the problem:
diff -r fad6feb87420 gcc/cfgrtl.c
--- a/gcc/cfgrtl.c Wed Nov 21 00:17:50 2007 +0000
+++ b/gcc/cfgrtl.c Wed Nov 21 14:07:15 2007 -0800
@@ -2629,6 +2629,7 @@ cfg_layout_merge_blocks (basic_block a,
/* In the case basic blocks are not adjacent, move them around. */
if (NEXT_INSN (BB_END (a)) != BB_HEAD (b))
{
+ rtx insn;
rtx first = unlink_insn_chain (BB_HEAD (b), BB_END (b));
emit_insn_after_noloc (first, BB_END (a), a);
@@ -2637,7 +2638,15 @@ cfg_layout_merge_blocks (basic_block a,
first = NEXT_INSN (first);
gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first));
BB_HEAD (b) = NULL;
+ insn = NEXT_INSN (first);
delete_insn (first);
+
+ for (; insn != NEXT_INSN (BB_END (b));
+ insn = NEXT_INSN (insn))
+ {
+ set_block_for_insn (insn, a);
+ df_insn_change_bb (insn);
+ }
}
/* Otherwise just re-associate the instructions. */
else
I'm going to stare at the surrounding code a bit more
to convince myself, and will do some testing.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (12 preceding siblings ...)
2007-11-21 22:09 ` spark at gcc dot gnu dot org
@ 2007-11-21 22:30 ` steven at gcc dot gnu dot org
2007-11-21 22:43 ` spark at gcc dot gnu dot org
` (6 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-11-21 22:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from steven at gcc dot gnu dot org 2007-11-21 22:30 -------
The patch is semi-wrong. The call to emit_insn_after_noloc() should already
set the proper BLOCK_FOR_INSN for every insn. Only doing the
df_insn_change_bb() should be sufficient.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (13 preceding siblings ...)
2007-11-21 22:30 ` steven at gcc dot gnu dot org
@ 2007-11-21 22:43 ` spark at gcc dot gnu dot org
2007-11-22 0:30 ` spark at gcc dot gnu dot org
` (5 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-11-21 22:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from spark at gcc dot gnu dot org 2007-11-21 22:43 -------
(In reply to comment #14)
> The patch is semi-wrong. The call to emit_insn_after_noloc() should already
> set the proper BLOCK_FOR_INSN for every insn. Only doing the
> df_insn_change_bb() should be sufficient.
Thanks Steven. Something like:
diff -r fad6feb87420 gcc/cfgrtl.c
--- a/gcc/cfgrtl.c Wed Nov 21 00:17:50 2007 +0000
+++ b/gcc/cfgrtl.c Wed Nov 21 14:40:43 2007 -0800
@@ -2629,6 +2629,7 @@ cfg_layout_merge_blocks (basic_block a,
/* In the case basic blocks are not adjacent, move them around. */
if (NEXT_INSN (BB_END (a)) != BB_HEAD (b))
{
+ rtx insn;
rtx first = unlink_insn_chain (BB_HEAD (b), BB_END (b));
emit_insn_after_noloc (first, BB_END (a), a);
@@ -2637,6 +2638,14 @@ cfg_layout_merge_blocks (basic_block a,
first = NEXT_INSN (first);
gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first));
BB_HEAD (b) = NULL;
+
+ /* emit_insn_after_noloc doesn't call df_insn_change_bb.
+ We need to explicitly call df_insn_change_bb here. */
+ for (insn = NEXT_INSN (first);
+ insn != NEXT_INSN (BB_END (b));
+ insn = NEXT_INSN (insn))
+ df_insn_change_bb (insn);
+
delete_insn (first);
}
/* Otherwise just re-associate the instructions. */
I see bunch of similar loops throughout cfgrtl.c.
I'll see if I should refactor those loops into separate functions
(one with set_block_for_insn and one without).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (14 preceding siblings ...)
2007-11-21 22:43 ` spark at gcc dot gnu dot org
@ 2007-11-22 0:30 ` spark at gcc dot gnu dot org
2007-11-22 7:06 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-11-22 0:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from spark at gcc dot gnu dot org 2007-11-22 00:30 -------
I'm bootstrapping the following patch. This includes some slight refactoring of
set_block_for_insn/df_insn_change_bb loops within cfgrtl.c.
It's mostly cosmetic change on top of the patch on comment #15.
diff -r fad6feb87420 gcc/cfgrtl.c
--- a/gcc/cfgrtl.c Wed Nov 21 00:17:50 2007 +0000
+++ b/gcc/cfgrtl.c Wed Nov 21 23:48:55 2007 +0000
@@ -465,23 +465,48 @@ emit_insn_at_entry (rtx insn)
commit_edge_insertions ();
}
-/* Update insns block within BB. */
+/* Update BLOCK_FOR_INSN of insns between BEGIN and END
+ including BEGIN but not END, and notify df of the change.
+ Note that NEXT_INSN (END) has to have a valid value
+ (either NULL or a pointer to a valid insn). */
+
+static void
+update_bb_for_insns (rtx begin, rtx end, basic_block bb)
+{
+ rtx insn;
+
+ for (insn = begin; insn != end; insn = NEXT_INSN (insn))
+ {
+ if (!BARRIER_P (insn))
+ {
+ set_block_for_insn (insn, bb);
+ df_insn_change_bb (insn);
+ }
+ }
+}
+
+/* Call df_insn_change_bb for insns between BEGIN and END
+ including BEGIN but not END.
+ Note that NEXT_INSN (END) has to have a valid value
+ (either NULL or a pointer to a valid insn). */
+
+static void
+notify_bb_change_for_insns (rtx begin, rtx end)
+{
+ rtx insn;
+
+ for (insn = begin; insn != end; insn = NEXT_INSN (insn))
+ if (!BARRIER_P (insn))
+ df_insn_change_bb (insn);
+}
+
+/* Update BLOCK_FOR_INSN of insns in BB to BB,
+ and notify df of the change. */
void
update_bb_for_insn (basic_block bb)
{
- rtx insn;
-
- for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
- {
- if (!BARRIER_P (insn))
- {
- set_block_for_insn (insn, bb);
- df_insn_change_bb (insn);
- }
- if (insn == BB_END (bb))
- break;
- }
+ update_bb_for_insns (BB_HEAD (bb), NEXT_INSN (BB_END (bb)), bb);
}
/* Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK
@@ -629,16 +654,7 @@ rtl_merge_blocks (basic_block a, basic_b
/* Reassociate the insns of B with A. */
if (!b_empty)
{
- rtx x;
-
- for (x = a_end; x != b_end; x = NEXT_INSN (x))
- {
- set_block_for_insn (x, a);
- df_insn_change_bb (x);
- }
-
- set_block_for_insn (b_end, a);
- df_insn_change_bb (b_end);
+ update_bb_for_insns (a_end, NEXT_INSN (b_end), a);
a_end = b_end;
}
@@ -843,14 +859,9 @@ try_redirect_by_replacing_jump (edge e,
which originally were or were created before jump table are
inside the basic block. */
rtx new_insn = BB_END (src);
- rtx tmp;
-
- for (tmp = NEXT_INSN (BB_END (src)); tmp != barrier;
- tmp = NEXT_INSN (tmp))
- {
- set_block_for_insn (tmp, src);
- df_insn_change_bb (tmp);
- }
+
+ update_bb_for_insns (NEXT_INSN (BB_END (src)),
+ barrier, src);
NEXT_INSN (PREV_INSN (new_insn)) = NEXT_INSN (new_insn);
PREV_INSN (NEXT_INSN (new_insn)) = PREV_INSN (new_insn);
@@ -2637,6 +2648,12 @@ cfg_layout_merge_blocks (basic_block a,
first = NEXT_INSN (first);
gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first));
BB_HEAD (b) = NULL;
+
+ /* emit_insn_after_noloc doesn't call df_insn_change_bb.
+ We need to explicitly notify. */
+ notify_bb_change_for_insns (NEXT_INSN (first),
+ NEXT_INSN (BB_END (b)));
+
delete_insn (first);
}
/* Otherwise just re-associate the instructions. */
@@ -2644,13 +2661,8 @@ cfg_layout_merge_blocks (basic_block a,
{
rtx insn;
- for (insn = BB_HEAD (b);
- insn != NEXT_INSN (BB_END (b));
- insn = NEXT_INSN (insn))
- {
- set_block_for_insn (insn, a);
- df_insn_change_bb (insn);
- }
+ update_bb_for_insns (BB_HEAD (b),
+ NEXT_INSN (BB_END (b)), a);
insn = BB_HEAD (b);
/* Skip possible DELETED_LABEL insn. */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (15 preceding siblings ...)
2007-11-22 0:30 ` spark at gcc dot gnu dot org
@ 2007-11-22 7:06 ` steven at gcc dot gnu dot org
2007-11-25 2:47 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-11-22 7:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from steven at gcc dot gnu dot org 2007-11-22 07:06 -------
I'd say s/update_bb_for_insns/update_bb_for_insn_chain/
And it doesn't hurt to set BLOCK_FOR_INSN, so now that the code is factored to
new functions, I'd also say
s/notify_bb_change_for_insns/update_bb_for_insn_chain/.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (16 preceding siblings ...)
2007-11-22 7:06 ` steven at gcc dot gnu dot org
@ 2007-11-25 2:47 ` pinskia at gcc dot gnu dot org
2007-11-27 22:25 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-25 2:47 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (17 preceding siblings ...)
2007-11-25 2:47 ` pinskia at gcc dot gnu dot org
@ 2007-11-27 22:25 ` mmitchel at gcc dot gnu dot org
2007-11-30 17:03 ` spark at gcc dot gnu dot org
2007-11-30 17:07 ` jakub at gcc dot gnu dot org
20 siblings, 0 replies; 22+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-11-27 22:25 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (18 preceding siblings ...)
2007-11-27 22:25 ` mmitchel at gcc dot gnu dot org
@ 2007-11-30 17:03 ` spark at gcc dot gnu dot org
2007-11-30 17:07 ` jakub at gcc dot gnu dot org
20 siblings, 0 replies; 22+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-11-30 17:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #18 from spark at gcc dot gnu dot org 2007-11-30 17:02 -------
Subject: Bug 34171
Author: spark
Date: Fri Nov 30 17:02:43 2007
New Revision: 130539
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130539
Log:
gcc/testsuite/ChangeLog:
2007-11-30 Martin Michlmayr <tbm@cyrius.com>
PR rtl-optimization/34171
* gcc.dg/pr34171.c: New testcase.
gcc/ChangeLog:
2007-11-30 Seongbae Park <seongbae.park@gmail.com>
PR rtl-optimization/34171
* cfgrtl.c (update_bb_for_insn_chain): New function,
refactored from update_bb_for_insn.
(update_bb_for_insn): Call update_bb_for_insn.
(rtl_merge_blocks, try_redirect_by_replacing_jump):
Replace a loop with update_bb_for_insn_chain call.
(cfg_layout_merge_blocks): Add a call to
update_bb_for_insn_chain. Replace the for loop
with a call to update_bb_for_insn_chain.
Added:
trunk/gcc/testsuite/gcc.dg/pr34171.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfgrtl.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
` (19 preceding siblings ...)
2007-11-30 17:03 ` spark at gcc dot gnu dot org
@ 2007-11-30 17:07 ` jakub at gcc dot gnu dot org
20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-30 17:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #19 from jakub at gcc dot gnu dot org 2007-11-30 17:07 -------
Fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2007-11-30 17:07 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-21 9:18 [Bug rtl-optimization/34171] New: [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha tbm at cyrius dot com
2007-11-21 9:19 ` [Bug rtl-optimization/34171] " tbm at cyrius dot com
2007-11-21 9:20 ` tbm at cyrius dot com
2007-11-21 9:20 ` tbm at cyrius dot com
2007-11-21 9:47 ` bonzini at gnu dot org
2007-11-21 10:56 ` tbm at cyrius dot com
2007-11-21 12:52 ` paolo dot bonzini at lu dot unisi dot ch
2007-11-21 16:22 ` spark at gcc dot gnu dot org
2007-11-21 17:47 ` steven at gcc dot gnu dot org
2007-11-21 18:11 ` tbm at cyrius dot com
2007-11-21 20:03 ` steven at gcc dot gnu dot org
2007-11-21 20:23 ` tbm at cyrius dot com
2007-11-21 20:41 ` spark at gcc dot gnu dot org
2007-11-21 22:09 ` spark at gcc dot gnu dot org
2007-11-21 22:30 ` steven at gcc dot gnu dot org
2007-11-21 22:43 ` spark at gcc dot gnu dot org
2007-11-22 0:30 ` spark at gcc dot gnu dot org
2007-11-22 7:06 ` steven at gcc dot gnu dot org
2007-11-25 2:47 ` pinskia at gcc dot gnu dot org
2007-11-27 22:25 ` mmitchel at gcc dot gnu dot org
2007-11-30 17:03 ` spark at gcc dot gnu dot org
2007-11-30 17:07 ` jakub 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).