[patch] Fortran: fix prototype for class vptr fields

FX fxcoudert@gmail.com
Sun Sep 6 11:12:31 GMT 2020


Hi,

Attached is a patch fixing the problem at: https://gcc.gnu.org/pipermail/fortran/2020-September/054978.html
the reasoning behind the solution is explained here: https://gcc.gnu.org/pipermail/fortran/2020-September/054997.html

In short, calls to class copy functions are made with wrong function type:

 <function_type 0x14461be70
    type <void_type 0x14460ff18 void VOID
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x14460ff18
        pointer_to_this <pointer_type 0x144617000>>
    SI
    size <integer_cst 0x144602eb8 type <integer_type 0x14460f0a8 bitsizetype> constant 32>
    unit-size <integer_cst 0x144602ed0 type <integer_type 0x14460f000 sizetype> constant 4>
    align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x14461be70
    arg-types <tree_list 0x1446097f8 value <void_type 0x14460ff18 void>>
    pointer_to_this <pointer_type 0x14461bf18>>

where the arg-types is (void) instead of being undefined (like K&R functions). This has no apparent consequences on current targets, but it leads to wrong code generation for aarch64-apple-darwin20.

The attached patch fixes this. The patch is regtested on x86_64-apple-darwin19.
I also tested it on aarch64-apple-darwin20 (Iain’s current port based on trunk at https://github.com/iains/gcc-darwin-arm64) where it brings the number of test failures down from 811 to 166!


OK to commit?

FX

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc_type.diff
Type: application/octet-stream
Size: 408 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20200906/8b0e4ff9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc_type.ChangeLog
Type: application/octet-stream
Size: 108 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20200906/8b0e4ff9/attachment-0001.obj>


More information about the Fortran mailing list