Bug 51796 - [4.7 regression] internal compiler error: in distribute_notes, at combine.c:13285 for libgomp/alloc.c on m68k-linux
Summary: [4.7 regression] internal compiler error: in distribute_notes, at combine.c:1...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-09 08:18 UTC by Mikael Pettersson
Modified: 2012-01-11 23:15 UTC (History)
2 users (show)

See Also:
Host:
Target: m68k-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
preprocessed source for libgomp/alloc.c (11.01 KB, application/octet-stream)
2012-01-09 08:18 UTC, Mikael Pettersson
Details
reduced test case (75 bytes, text/plain)
2012-01-09 13:19 UTC, Mikael Pettersson
Details
gcc47-pr51796.patch (380 bytes, patch)
2012-01-09 23:24 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Pettersson 2012-01-09 08:18:47 UTC
Created attachment 26276 [details]
preprocessed source for libgomp/alloc.c

Bootstrapping gcc-4.7-20120107 on m68k-linux fails during all-stage1-target-libgomp with:

/mnt/scratch/objdir47/./gcc/xgcc -B/mnt/scratch/objdir47/./gcc/ -B/mnt/scratch/install47/m68k-unknown-linux-gnu/bin/ -B/mnt/scratch/install47/m68k-unknown-linux-gnu/lib/ -isystem /mnt/scratch/install47/m68k-unknown-linux-gnu/include -isystem /mnt/scratch/install47/m68k-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/mnt/scratch/gcc-4.7-20120107/libgomp -I/mnt/scratch/gcc-4.7-20120107/libgomp/config/posix -I/mnt/scratch/gcc-4.7-20120107/libgomp -Wall -Werror -pthread -ftls-model=initial-exec -g -O2 -MT alloc.lo -MD -MP -MF .deps/alloc.Tpo -c /mnt/scratch/gcc-4.7-20120107/libgomp/alloc.c -o alloc.o
/mnt/scratch/gcc-4.7-20120107/libgomp/alloc.c: In function 'gomp_malloc':
/mnt/scratch/gcc-4.7-20120107/libgomp/alloc.c:40:1: internal compiler error: in distribute_notes, at combine.c:13285

The previous weekly snapshot, gcc-4.7-20111231, built fine (once r182819 was backported to fix PR51725)
Comment 1 Mikael Pettersson 2012-01-09 12:44:35 UTC
It's caused by r182924:

Author: jakub
Date: Thu Jan  5 20:47:16 2012
New Revision: 182924

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182924
Log:
	PR debug/51762
	* calls.c (emit_call_1): For noreturn calls force a REG_ARGS_SIZE
	note when !ACCUMULATE_OUTGOING_ARGS.

m68k is !ACCUMULATE_OUTGOING_ARGS, so it triggers this change.
Comment 2 Mikael Pettersson 2012-01-09 13:19:23 UTC
Created attachment 26279 [details]
reduced test case
Comment 3 Jakub Jelinek 2012-01-09 16:52:57 UTC
I guess the assert should be adjusted, from gcc_assert (old_size != args_size);
to gcc_assert (old_size != args_size || find_reg_note (i3, REG_NORETURN, NULL));
because we add the REG_ARGS_SIZE notes now even to noreturn calls where there is no difference from previous args size.
Can't test it right now though.
Comment 4 Mikael Pettersson 2012-01-09 20:56:12 UTC
The "|| find_reg_note (i3, REG_NORETURN, NULL)" bit also failed because i3 has no notes at all.  INSN_CODE (i3) == 437, which seems to correspond to "*call" from m68k.md.
Comment 5 Jakub Jelinek 2012-01-09 23:24:16 UTC
Created attachment 26288 [details]
gcc47-pr51796.patch

Ah, REG_UNUSED might be still in next_note chain, not processed yet by distribute_notes.  Completely (not even compile time) tested patch.
Comment 6 Andreas Schwab 2012-01-09 23:52:41 UTC
Still fails in gcc_assert (n).
Comment 7 Zdenek Sojka 2012-01-10 05:45:55 UTC
I hit this (probably) ICE with more obscure flags, with a x86_64-unknown-linux-gnu target:

$ gcc -Os -fno-omit-frame-pointer -fno-tree-dominator-opts -fno-tree-fre -fno-tree-pre testsuite/gcc.c-torture/compile/pr39941.c
testsuite/gcc.c-torture/compile/pr39941.c: In function 'bsd_boot':
testsuite/gcc.c-torture/compile/pr39941.c:11:1: internal compiler error: in distribute_notes, at combine.c:13285
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 8 Jakub Jelinek 2012-01-10 07:47:55 UTC
Ah, obviously s/REG_UNUSED/REG_NORETURN/g in the patch, sorry for that.
Comment 9 Mikael Pettersson 2012-01-10 09:10:07 UTC
(In reply to comment #8)
> Ah, obviously s/REG_UNUSED/REG_NORETURN/g in the patch, sorry for that.

With the above modification I can now build a cross successfully.  I'll resume my native bootstrap now with it applied and see how it goes.
Comment 10 Jakub Jelinek 2012-01-11 22:59:16 UTC
Author: jakub
Date: Wed Jan 11 22:59:12 2012
New Revision: 183111

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183111
Log:
	PR bootstrap/51796
	* combine.c (distribute_notes): If i3 is a noreturn call,
	allow old_size to be equal to args_size and make sure the
	noreturn call gets REG_ARGS_SIZE note.
	* expr.c (fixup_args_size_notes): Put REG_ARGS_SIZE notes
	on noreturn calls even when the delta is 0.

	* gcc.dg/pr51796.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr51796.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/expr.c
    trunk/gcc/testsuite/ChangeLog
Comment 11 Jakub Jelinek 2012-01-11 23:15:11 UTC
Should be fixed now.