[Patch] Fortran: Fix CLASS handling in SIZEOF intrinsic

Tobias Burnus tobias@codesourcery.com
Tue Mar 8 20:06:03 GMT 2022


Fix SIZEOF handling.

I have to admit that I do understand what the current code does,
but do not understand what the previous code did. However, it
still passes the testsuite - and also some code which did ICE
now compiles :-)

While writing the testcase, I did find two issues:
* Passing a CLASS to TYPE(*),dimension(..) will have an
   elem_len of the declared type and not of the dynamic type.
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104844
* var%class_array(1,1)%array will have size(...) == 0
   instead of size(... % array).
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104845

OK for mainline? (Unless you want to hold off until GCC 13)

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sizeof.diff
Type: text/x-patch
Size: 18724 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20220308/794f840a/attachment-0001.bin>


More information about the Fortran mailing list