[PATCH, Fortran] PR 80668: wrong error message with -finit-derived

Fritz Reese fritzoreese@gmail.com
Tue May 9 15:38:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80668

All,

The following fixes a bug exposed in PR 80668 in which the compiler
attempted to generate an initializer for components of derived types
with the POINTER attribute when compiling with -finit-derived and
-finit-*=*. It is nonsensical for components with the POINTER
attribute to have initializers generated in this way. The resolution
phase caught the resulting contradictions, resulting in an error for
the testcase given in the PR.

With the patch all regression tests pass except for the following,
which already fail in the current trunk (r247800):

Running /data/midas/foreese/src/gcc-dev/gcc/testsuite/gfortran.dg/dg.exp ...
FAIL: gfortran.dg/coarray_lock_7.f90   -O   scan-tree-dump-times
original "_gfortran_caf_lock \\(caf_token.., \\(3 -
\\(integer\\(kind=4\\)\\) parm...dim\\[0\\].lbound\\) \\+
\\(integer\\(kind=4\\)\\) MAX_EXPR <\\(parm...dim\\[0\\].ubound -
parm...dim\\[0\\].lbound\\) \\+ 1, 0> \\* \\(3 -
\\(integer\\(kind=4\\)\\) parm...dim\\[1\\].lbound\\), 0, 0B, &ii, 0B,
0\\);|_gfortran_caf_lock \\(caf_token.1, \\(3 -
parm...dim\\[0\\].lbound\\) \\+ MAX_EXPR <\\(parm...dim\\[0\\].ubound
- parm...dim\\[0\\].lbound\\) \\+ 1, 0> \\* \\(3 -
parm...dim\\[1\\].lbound\\), 0, 0B, &ii, 0B, 0\\);" 1
FAIL: gfortran.dg/coarray_lock_7.f90   -O   scan-tree-dump-times
original "_gfortran_caf_unlock \\(caf_token.., \\(2 -
\\(integer\\(kind=4\\)\\) parm...dim\\[0\\].lbound\\) \\+
\\(integer\\(kind=4\\)\\) MAX_EXPR <\\(parm...dim\\[0\\].ubound -
parm...dim\\[0\\].lbound\\) \\+ 1, 0> \\* \\(3 -
\\(integer\\(kind=4\\)\\) parm...dim\\[1\\].lbound\\), 0, &ii, 0B,
0\\);|_gfortran_caf_unlock \\(caf_token.., \\(2 -
parm...dim\\[0\\].lbound\\) \\+ MAX_EXPR <\\(parm...dim\\[0\\].ubound
- parm...dim\\[0\\].lbound\\) \\+ 1, 0> \\* \\(3 -
parm...dim\\[1\\].lbound\\), 0, &ii, 0B, 0\\);" 1
FAIL: gfortran.dg/mvbits_7.f90   -O0   (test for warnings, line 28)


OK for trunk?

---
Fritz Reese

2017-05-09  Fritz Reese <fritzoreese@gmail.com>

    PR fortran/80668

    gcc/fortran/ChangeLog:

        PR fortran/80668
        * expr.c (component_initializer): Don't generate initializers for
        pointer components.
        * invoke.texi (-finit-derived): Document.

    gcc/testsuite/ChangeLog:

        PR fortran/80668
        * gfortran.dg/pr80668.f90: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr80660.patch
Type: text/x-patch
Size: 3043 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170509/9035f89c/attachment.bin>


More information about the Fortran mailing list