Bug 20370 - dead_or_predictable doesn't resize reg_n_info
Summary: dead_or_predictable doesn't resize reg_n_info
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, patch, wrong-code
Depends on:
Blocks:
 
Reported: 2005-03-07 21:30 UTC by Jorn Wolfgang Rennecke
Modified: 2005-07-22 17:21 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-07-20 22:23:44


Attachments
proposed fix (649 bytes, patch)
2005-03-07 21:32 UTC, Jorn Wolfgang Rennecke
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2005-03-07 21:30:15 UTC
dead_or_predictable calls propagate_block without checking first if there
is suddicient space in reg_n_info.  That can lead to memory corruption.
Comment 1 Jorn Wolfgang Rennecke 2005-03-07 21:32:03 UTC
Created attachment 8356 [details]
proposed fix
Comment 2 GCC Commits 2005-07-18 14:57:23 UTC
Subject: Bug 20370

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	sh-elf-4_1-branch
Changes by:	amylaar@gcc.gnu.org	2005-07-18 14:57:06

Modified files:
	gcc            : ChangeLog loop.c cse.c calls.c ifcvt.c 

Log message:
	2005-07-15  J"orn Rennecke <joern.rennecke@st.com>
	
	cvs update -j1.531 -j1.530 loop.c
	Re-apply this patch:
	2005-05-30  Pat Haugen  <pthaugen@us.ibm.com>
	* loop.c (loop_invariant_p, valid_initial_value_p): Use
	regs_invalidated_by_call instead of call_used_regs.
	
	2005-07-15  J"orn Rennecke <joern.rennecke@superh.com>
	
	PR rtl-optimization/18992
	http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01140.html
	Back out this patch:
	2003-10-08  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
	PR optimization/12142
	* cse.c (count_reg_usage): In a SET with a REG SET_DEST, count the
	uses of the register in the SET_SRC.  Remove unnecessary argument.
	
	Replace it with this:
	* cse.c (count_reg_usage): In INSN, JUMP_INSN and CALL_INSN cases,
	if flag_non_call_exceptions is set and the insn may trap, pass
	pc_rtx as dest for recursion.
	In SET_SRC part of SET case, if dest is already set, pass it down
	unchanged.
	
	2005-07-15  J"orn Rennecke <joern.rennecke@superh.com>
	
	PR rtl-optimization/21848
	http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01142.html
	* calls.c (emit_library_call_value_1): For const functions, add
	USEs of the stack slots to CALL_INSN_FUNCTION_USAGE.
	
	2005-07-15  J"orn Rennecke <joern.rennecke@superh.com>
	
	PR rtl-optimization/20370
	http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01148.html
	* ifcvt.c (dead_or_predicable): Before calling propagate_block,
	call allocate_reg_info if necessary.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=2.8142.2.23&r2=2.8142.2.24
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.525.2.2&r2=1.525.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cse.c.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.351.2.1&r2=1.351.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/calls.c.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.385.2.1&r2=1.385.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ifcvt.c.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.184.2.2&r2=1.184.2.3

Comment 3 Andrew Pinski 2005-07-20 22:23:44 UTC
Confirmed.
Comment 4 GCC Commits 2005-07-22 12:25:38 UTC
Subject: Bug 20370

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amylaar@gcc.gnu.org	2005-07-22 12:25:22

Modified files:
	gcc            : ChangeLog ifcvt.c 

Log message:
	PR rtl-optimization/20370
	* ifcvt.c (dead_or_predicable): Before calling propagate_block,
	call allocate_reg_info if necessary.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9518&r2=2.9519
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ifcvt.c.diff?cvsroot=gcc&r1=1.193&r2=1.194

Comment 5 Andrew Pinski 2005-07-22 17:21:46 UTC
Fixed.