[patch] Fix type consistency problem in tree-tailcall.c

Eric Botcazou ebotcazou@adacore.com
Wed Nov 3 10:31:00 GMT 2010


Hi,

the attached testcase exhibits a regression present at -O2 on the mainline 
with checking enabled:

/home/eric/svn/gcc/gcc/testsuite/gnat.dg/opt8.adb:25:5: error: type mismatch 
in binary expression
natural___XDLU_0__2147483647
const integer
natural___XDLU_0__2147483647
D.2693_51 = R3b_27 + add_acc.25_49;
+===========================GNAT BUG DETECTED==============================+
| 4.6.0 20101102 (experimental) [trunk revision 166172] (i586-suse-linux-gnu) 
GCC error:|
| verify_stmts failed                                                      |
| Error detected 
around /home/eric/svn/gcc/gcc/testsuite/gnat.dg/opt8.adb:25:5|


The problem is that, while the code to discover tail calls knows how to look 
through casts, it doesn't reinstate them when it is building expressions to 
compute the accumulator and multiplicator values.  Hence the attached patch.

Tested on i586-suse-linux, OK for the mainline?


2010-11-03  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-tailcall.c (find_tail_calls): Convert the operands to the type
	of the result before building binary expressions.


2010-11-03  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/opt8.ad[sb]: New test.
	* gnat.dg/opt8_pkg.ads: New helper.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 854 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101103/024c3b9c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt8.ads
Type: text/x-adasrc
Size: 1247 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101103/024c3b9c/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt8.adb
Type: text/x-adasrc
Size: 1350 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101103/024c3b9c/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt8_pkg.ads
Type: text/x-adasrc
Size: 123 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101103/024c3b9c/attachment-0003.bin>


More information about the Gcc-patches mailing list