]> git.feebdaed.xyz Git - 0xmirror/gcc.git/commit
fortran: [PR121472] Fix ICE with constructor for finalized zero-size type.
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 21 Dec 2025 21:33:15 +0000 (13:33 -0800)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 21 Dec 2025 21:33:15 +0000 (13:33 -0800)
commit5bb465a789600a46f3b53b236ba07b30cea6cbac
tree30925f12f33bf69f3e1a6a8d9fdc99235cd9eaeb
parenta30b5f23b58b236207e59635cf7e9504c603f376
fortran: [PR121472] Fix ICE with constructor for finalized zero-size type.

When a derived type has a final subroutine and a constructor interface,
but is effectively zero-sized, the gimplifier fails on the finalization
code.  The existing check for empty types (!derived->components) only
catches completely empty types, not types with empty components.
Replace with a tree-level TYPE_SIZE_UNIT check that catches all
zero-size cases.

PR fortran/121472

gcc/fortran/ChangeLog:

* trans.cc (gfc_finalize_tree_expr): Replace !derived->components
check with TYPE_SIZE_UNIT check for zero-size types.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr121472.f90: New test.
gcc/fortran/trans.cc
gcc/testsuite/gfortran.dg/pr121472.f90 [new file with mode: 0644]