This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, middle-end]: Fix PR 37286, ICE subst_stack_regs_pat, at reg-stack.c:1537


Hello!

This is another example of uninitialized variable confusing regstack.
Instead of ICEing on uninitialized stack slot, initialize variable
with a NaN. This way, we will generate FP exception if program flow
reaches the instruction (if exceptions are enabled), but we will be
able to compile the source.

BTW: Compiling original fortran testcase from the PR with -Wall, we indeed get:

pr37286.f90: In function 'gn_monte_rand':
pr37286.f90:31: warning: 'monte_temp' may be used uninitialized in this function

2008-11-03  Uros Bizjak  <ubizjak@gmail.com>

	PR middle-end/37286
	* reg-stack.c (subst_stack_regs_pat) [MINUS, DIV, MULT, PLUS]:
	Initialize uninitialized input registers with a NaN.

testsuite/ChangeLog:

2008-11-03  Uros Bizjak  <ubizjak@gmail.com>

	PR middle-end/37286
	* gfortran.dg/pr37286.f90: New test.

The patch was bootstrapped and regression tested on i686-pc-linux-gnu.
OK for mainline?

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]