https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69185
Bug ID: 69185 Summary: bounds-check gives false positive on assignment to allocatable array Product: gcc Version: 4.9.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: townsend at astro dot wisc.edu Target Milestone: --- Created attachment 37255 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37255&action=edit Source code of program reproducing the problem Compile the attached code with: gfortran -fbounds-check -std=f2003 -o foo foo.f90 On execution, the assignment to b should be OK, since b will be allocated to match the shape of the RHS (as per F2003). However, the following run-time error instead occurs: At line 8 of file foo.f90 Fortran runtime error: Array bound mismatch for dimension 1 of array 'b' (20/4) The problem does not arise if I use, e.g., 'a' on the RHS instead of 'exp(a)'.