[gfortran,patch] Fix PR32046 by avoiding mismatched types coming from TYPE_SIZE_UNIT

FX Coudert fxcoudert@gmail.com
Tue May 22 21:29:00 GMT 2007


Hi all,

Attached patch is a fix for PR32046, a 4.3 regression due to a  
preexisting bug in the front-end, which was exposed on 64-bit  
platforms by my malloc/free patch (due to the additional optimization  
done by the middle-end). The bug is actually simple: we build array  
sizes with TYPE_SIZE_UNIT, which is unsigned, and we multiplied it  
with the item count (signed) to obtain the size (signed). This simple  
patch reviews the use of TYPE_SIZE_UNIT in the front-end, and  
converts it to the signed type every time it will be used for signed  
calculations.

Bootstrapped and regtested on x86_64-linux, doesn't come with a  
testcase since there already are two in our testsuite. OK for mainline?


:ADDPATCH fortran:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TYPE_SIZE_UNIT.ChangeLog
Type: application/octet-stream
Size: 484 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070522/a4aed502/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TYPE_SIZE_UNIT.diff
Type: application/octet-stream
Size: 4808 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070522/a4aed502/attachment-0001.obj>


More information about the Fortran mailing list