[Patch, Fortran] PR35093 fix ICE with gfortran.dg/data_constraints_1.f90

Tobias Burnus burnus@net-b.de
Tue Feb 5 18:30:00 GMT 2008


gfortran was freeing (mpz_clear()ing) the variable "size" twice in

              mpz_t size;
              if (spec_size (ref->u.ar.as, &size) == SUCCESS
                   && mpz_cmp (offset, size) >= 0)
                {
                  mpz_clear (size);
                  gfc_error ("Data element above array upper bound at %L",
                             &lvalue->where);
                  return FAILURE;
                }
              mpz_clear (size);


The problem is that for "spec_size == FAILED" the variable is already 
cleared. At least with glibc's memory checking turned on, this causes 
gfortran to crash for gfortran.dg/data_constraints_1.f90. The solution 
is simple: Only clear "size" if spec_size returned SUCCESS. (The code 
above has been introduced in the fix for 32315, which makes it a 
regression.)

It is unclear to me whether it can also crash for valid code or only for 
invalid code.

Build and regtested on x86-64-linux.
OK for the trunk (4.3.0)?

Tobias

PS: As the patch for PR 33553 has been approved, there are no unapproved 
P1 regressions left, which means that GCC will have the RC1 freeze soon; 
soon after we are expected to see the RC1 together with a 4.4.0 trunk.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: data.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080205/c78c7d54/attachment.ksh>


More information about the Gcc-patches mailing list