This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran,patch] Fix PR32046 by avoiding mismatched types coming from TYPE_SIZE_UNIT
- From: FX Coudert <fxcoudert at gmail dot com>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 22 May 2007 23:29:35 +0200
- Subject: [gfortran,patch] Fix PR32046 by avoiding mismatched types coming from TYPE_SIZE_UNIT
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:Attachment:
TYPE_SIZE_UNIT.ChangeLog
Description: Binary data
Attachment:
TYPE_SIZE_UNIT.diff
Description: Binary data