public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
@ 2012-10-16 11:02 amylaar at gcc dot gnu.org
2012-10-16 11:44 ` [Bug target/54938] " olegendo at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: amylaar at gcc dot gnu.org @ 2012-10-16 11:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
Bug #: 54938
Summary: sh libgcc_unpack_df.o fails to build:
../../../srcw/libgcc/fp-bit.h:221:19: internal
compiler error: in emit_cmp_and_jump_insn_1, at
optabs.c:4273
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: amylaar@gcc.gnu.org
Target: sh-elf
"make -j8 all-gcc all-target-libgcc all-target-newlib"" fails at _unpack_df.o:
/home/amylaar/fsf/sh-192491/./gcc/xgcc -B/home/amylaar/fsf/sh-192491/./gcc/
-nostdinc -B/home/amylaar/fsf/sh-192491/sh-elf/newlib/ -isystem
/home/amylaar/fsf/sh-192491/sh-elf/newlib/targ-include -isystem
/home/amylaar/fsf/srcw/newlib/libc/include
-B/home/amylaar/fsf/sh-192491/sh-elf/libgloss/sh
-L/home/amylaar/fsf/sh-192491/sh-elf/libgloss/libnosys
-L/home/amylaar/fsf/srcw/libgloss/sh -B/usr/local/sh-elf/bin/
-B/usr/local/sh-elf/lib/ -isystem /usr/local/sh-elf/include -isystem
/usr/local/sh-elf/sys-include -L/home/amylaar/fsf/sh-192491/./ld -g -O2 -O2
-g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -g -DIN_LIBGCC2 -fbuilding-libgcc
-fno-stack-protector -Dinhibit_libc -I. -I. -I../.././gcc
-I../../../srcw/libgcc -I../../../srcw/libgcc/. -I../../../srcw/libgcc/../gcc
-I../../../srcw/libgcc/../include -DHAVE_CC_TLS -o _unpack_df.o -MT
_unpack_df.o -MD -MP -MF _unpack_df.dep -DFINE_GRAINED_LIBRARIES -DL_unpack_df
-c ../../../srcw/libgcc/fp-bit.c -fvisibility=hidden -DHIDE_EXPORTS
...
In file included from ../../../srcw/libgcc/fp-bit.c:41:0:
../../../srcw/libgcc/fp-bit.c: In function ‘__unpack_d’:
../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in
emit_cmp_and_jump_insn_1, at optabs.c:4273
# define unpack_d __unpack_d
^
../../../srcw/libgcc/fp-bit.c:442:1: note: in expansion of macro 'unpack_d'
unpack_d (FLO_union_type * src, fp_number_type * dst)
^
In file included from ../../../srcw/libgcc/fp-bit.c:41:0:
../../../srcw/libgcc/fp-bit.c: In function ‘__pack_d’:
../../../srcw/libgcc/fp-bit.h:220:17: internal compiler error: in
emit_cmp_and_jump_insn_1, at optabs.c:4273
# define pack_d __pack_d
^
../../../srcw/libgcc/fp-bit.c:199:1: note: in expansion of macro 'pack_d'
pack_d (const fp_number_type *src)
^
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
@ 2012-10-16 11:44 ` olegendo at gcc dot gnu.org
2012-10-16 12:36 ` amylaar at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-10-16 11:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |olegendo at gcc dot gnu.org
--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-16 11:43:37 UTC ---
Could you please try to extract a preprocessed source for this one? I'm afraid
some of my recent patches for PR 51244 might have introduced this :T
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
2012-10-16 11:44 ` [Bug target/54938] " olegendo at gcc dot gnu.org
@ 2012-10-16 12:36 ` amylaar at gcc dot gnu.org
2012-10-16 13:28 ` olegendo at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: amylaar at gcc dot gnu.org @ 2012-10-16 12:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
--- Comment #2 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> 2012-10-16 12:35:47 UTC ---
Created attachment 28454
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28454
preprocessed source
cc1 invocation from using -v --save-temps:
/home/amylaar/fsf/sh-192491/./gcc/cc1 -fpreprocessed fp-bit.i -quiet -dumpbase
fp-bit.c -auxbase-strip _unpack_df.o -g -g -g -O2 -O2 -O2 -Wextra -Wall
-Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -version -fbuilding-libgcc
-fno-stack-protector -fvisibility=hidden -o fp-bit.s
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
2012-10-16 11:44 ` [Bug target/54938] " olegendo at gcc dot gnu.org
2012-10-16 12:36 ` amylaar at gcc dot gnu.org
@ 2012-10-16 13:28 ` olegendo at gcc dot gnu.org
2012-10-16 17:04 ` eraman at google dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-10-16 13:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-10-16
CC| |eraman at google dot com
Ever Confirmed|0 |1
--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-16 13:28:10 UTC ---
Thanks Jörn.
The problem is not related to my changes in PR 51244. It is caused by the
latest change to optabs.c:
2012-10-15 Easwaran Raman <eraman@google.com>
* optabs.c (emit_cmp_and_jump_insn_1): Add a new parameter to
specificy the probability of taking the jump.
(emit_cmp_and_jump_insns): Likewise.
In emit_cmp_and_jump_insn_1, the line
gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
blows up, because of config/sh/sh.c (expand_cbranchsi4):
rtx jump = emit_jump_insn (branch_expander (operands[3]));
if (probability >= 0)
add_reg_note (jump, REG_BR_PROB, GEN_INT (probability));
The following seems to fix the problem
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c (revision 192494)
+++ gcc/optabs.c (working copy)
@@ -4270,8 +4270,8 @@
&& JUMP_P (insn)
&& any_condjump_p (insn))
{
- gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
- add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
+ if (!find_reg_note (insn, REG_BR_PROB, 0))
+ add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
}
}
Easwaran, could you please have a look at that? Does the change above make
sense?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
` (2 preceding siblings ...)
2012-10-16 13:28 ` olegendo at gcc dot gnu.org
@ 2012-10-16 17:04 ` eraman at google dot com
2012-10-16 21:22 ` olegendo at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: eraman at google dot com @ 2012-10-16 17:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
--- Comment #4 from Easwaran Raman <eraman at google dot com> 2012-10-16 17:04:05 UTC ---
(In reply to comment #3)
> Thanks Jörn.
> The problem is not related to my changes in PR 51244. It is caused by the
> latest change to optabs.c:
>
> 2012-10-15 Easwaran Raman <eraman@google.com>
> * optabs.c (emit_cmp_and_jump_insn_1): Add a new parameter to
> specificy the probability of taking the jump.
> (emit_cmp_and_jump_insns): Likewise.
>
>
> In emit_cmp_and_jump_insn_1, the line
>
> gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
>
> blows up, because of config/sh/sh.c (expand_cbranchsi4):
>
> rtx jump = emit_jump_insn (branch_expander (operands[3]));
> if (probability >= 0)
> add_reg_note (jump, REG_BR_PROB, GEN_INT (probability));
I am confused why this code causes the assert in emit_cmp_and_jump_insn_1.
Could you please attach a stack trace?
>
> The following seems to fix the problem
>
> Index: gcc/optabs.c
> ===================================================================
> --- gcc/optabs.c (revision 192494)
> +++ gcc/optabs.c (working copy)
> @@ -4270,8 +4270,8 @@
> && JUMP_P (insn)
> && any_condjump_p (insn))
> {
> - gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
> - add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
> + if (!find_reg_note (insn, REG_BR_PROB, 0))
> + add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
> }
> }
>
>
> Easwaran, could you please have a look at that? Does the change above make
> sense?
While this would certainly make the error go away, it will be good to
understand the root cause. If there is a REG_BR_PROB note already but the
probability is different from what is passed to emit_cmp_and_jump_insn_1,
should the existing value be replaced or left as such.
Thanks,
Easwaran
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
` (3 preceding siblings ...)
2012-10-16 17:04 ` eraman at google dot com
@ 2012-10-16 21:22 ` olegendo at gcc dot gnu.org
2012-10-31 23:29 ` eraman at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-10-16 21:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-16 21:22:02 UTC ---
(In reply to comment #4)
> >
> > In emit_cmp_and_jump_insn_1, the line
> >
> > gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0));
> >
> > blows up, because of config/sh/sh.c (expand_cbranchsi4):
> >
> > rtx jump = emit_jump_insn (branch_expander (operands[3]));
> > if (probability >= 0)
> > add_reg_note (jump, REG_BR_PROB, GEN_INT (probability));
>
> I am confused why this code causes the assert in emit_cmp_and_jump_insn_1.
Summary: The backend attaches REG_BR_PROB notes when it expands cbranch
patterns. The assumption in emit_cmp_and_jump_insn_1 is that no such notes
have been attached yet.
> Could you please attach a stack trace?
A simplified stack trace:
../../../srcw/libgcc/fp-bit.c: In function '__unpack_d':
../../../srcw/libgcc/fp-bit.c:442:1: internal compiler error: in
emit_cmp_and_jump_insn_1, at optabs.c:4275
0x847036a emit_cmp_and_jump_insn_1
../../gcc-trunk-van/gcc/optabs.c:4275
0x847036a emit_cmp_and_jump_insns(rtx_def*, rtx_def*, rtx_code, rtx_def*,
machine_mode, int, rtx_def*, int)
../../gcc-trunk-van/gcc/optabs.c:4326
0x826e167 do_compare_rtx_and_jump(rtx_def*, rtx_def*, rtx_code, int,
machine_mode, rtx_def*, rtx_def*, rtx_def*, int)
../../gcc-trunk-van/gcc/dojump.c:1072
0x826f680 do_jump(tree_node*, rtx_def*, rtx_def*, int)
../../gcc-trunk-van/gcc/dojump.c:591
0x8271a87 jumpifnot_1(tree_code, tree_node*, tree_node*, rtx_def*, int)
../../gcc-trunk-van/gcc/dojump.c:116
0x8211433 expand_gimple_cond
../../gcc-trunk-van/gcc/cfgexpand.c:1850
0x8219a47 expand_gimple_basic_block
../../gcc-trunk-van/gcc/cfgexpand.c:3830
0x821b337 gimple_expand_cfg
../../gcc-trunk-van/gcc/cfgexpand.c:4475
... but it doesn't show where the REG_BR_PROB reg note comes from.
What happens is that 'emit_cmp_and_jump_insn_1' invokes 'emit_jump_insn' which
ends up expanding the cbranchsi4 insn in the backend's machine description. On
SH, the cbranchsi4 expander invokes expand_cbranchsi4 (in sh.c), which attaches
a REG_BR_PROB note.
In case of SImode cbranch, the probability is always set to -1 and
expand_cbranchsi4 does not attach a note. So no problem with this one.
However, when it comes to DImode cbranch (cbranchdi4), SH's expand_cbranchdi4
will split & expand the comparison into multiple SImode cbranch insns and
attach REG_BR_PROB notes to them. After that it returns to
emit_cmp_and_jump_insn_1 and the assert blows.
> If there is a REG_BR_PROB note already but the
> probability is different from what is passed to emit_cmp_and_jump_insn_1,
> should the existing value be replaced or left as such.
Hm, or maybe try to accumulate the probabilities in some useful way? In this
crashing case for the DImode comparison prob in emit_cmp_and_jump_insn_1 is
6100, and SH's expand_cbranchdi4 expands two cbranchsi4 insns, one with prob
'-1' (i.e. no reg note), and another one with '0'.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
` (4 preceding siblings ...)
2012-10-16 21:22 ` olegendo at gcc dot gnu.org
@ 2012-10-31 23:29 ` eraman at gcc dot gnu.org
2012-11-01 21:20 ` olegendo at gcc dot gnu.org
2012-11-05 1:36 ` olegendo at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: eraman at gcc dot gnu.org @ 2012-10-31 23:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
--- Comment #6 from eraman at gcc dot gnu.org 2012-10-31 23:28:52 UTC ---
Author: eraman
Date: Wed Oct 31 23:28:45 2012
New Revision: 193052
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193052
Log:
2012-10-31 Easwaran Raman <eraman@google.com>
PR target/54938
PR middle-end/54957
* optabs.c (emit_cmp_and_jump_insn_1): Add REG_BR_PROB note
only if it doesn't already exist.
* stmt.c (get_outgoing_edge_probs): Return 0 if BB is NULL.
(emit_case_dispatch_table): Handle the case where STMT_BB is
NULL.
(expand_sjlj_dispatch_table): Pass BB containing before_case
to emit_case_dispatch_table.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/optabs.c
trunk/gcc/stmt.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
` (5 preceding siblings ...)
2012-10-31 23:29 ` eraman at gcc dot gnu.org
@ 2012-11-01 21:20 ` olegendo at gcc dot gnu.org
2012-11-05 1:36 ` olegendo at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-11-01 21:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
--- Comment #7 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-11-01 21:19:53 UTC ---
I guess this is done, isn't it Easwaran?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
` (6 preceding siblings ...)
2012-11-01 21:20 ` olegendo at gcc dot gnu.org
@ 2012-11-05 1:36 ` olegendo at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-11-05 1:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #8 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-11-05 01:36:41 UTC ---
I think this can be closed as it has been fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-05 1:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16 11:02 [Bug target/54938] New: sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273 amylaar at gcc dot gnu.org
2012-10-16 11:44 ` [Bug target/54938] " olegendo at gcc dot gnu.org
2012-10-16 12:36 ` amylaar at gcc dot gnu.org
2012-10-16 13:28 ` olegendo at gcc dot gnu.org
2012-10-16 17:04 ` eraman at google dot com
2012-10-16 21:22 ` olegendo at gcc dot gnu.org
2012-10-31 23:29 ` eraman at gcc dot gnu.org
2012-11-01 21:20 ` olegendo at gcc dot gnu.org
2012-11-05 1:36 ` olegendo at gcc dot gnu.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).