Bug 44649 - [OOP] F2008: storage_size intrinsic (also working for polymorphic types)
Summary: [OOP] F2008: storage_size intrinsic (also working for polymorphic types)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: janus
URL:
Keywords:
Depends on:
Blocks: 39627
  Show dependency treegraph
 
Reported: 2010-06-23 15:41 UTC by Tobias Burnus
Modified: 2010-07-08 21:34 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-07-06 21:26:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2010-06-23 15:41:38 UTC
Cf. F2008:
   13.7.160 STORAGE SIZE (A [, KIND])

   Description. Storage size in bits.
   Class. Inquiry function.
   Arguments.
     A   shall be a scalar or array of any type. If it is polymorphic it shall
         not be an undefined pointer. If it has any deferred type parameters it
         shall not be an unallocated allocatable variable or a disassociated
         or undefined pointer.
    KIND (optional) shall be a scalar integer constant expression.


Similarly to C_SIZEOF, but returns always the size for a scalar and supports dynamic types. Additionally, (C_)SIZEOF return the size in bytes, storage_size in bits.
Comment 1 janus 2010-07-06 21:26:22 UTC
Mine (I'm working on a patch).
Comment 2 janus 2010-07-08 21:30:18 UTC
Subject: Bug 44649

Author: janus
Date: Thu Jul  8 21:29:56 2010
New Revision: 161977

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161977
Log:
2010-07-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44649
	* gfortran.h (gfc_isym_id): Add GFC_ISYM_C_SIZEOF,GFC_ISYM_STORAGE_SIZE.
	* intrinsic.h (gfc_check_c_sizeof,gfc_check_storage_size,
	gfc_resolve_storage_size): New prototypes.
	* check.c (gfc_check_c_sizeof,gfc_check_storage_size): New functions.
	* intrinsic.c (add_functions): Add STORAGE_SIZE.
	* iresolve.c (gfc_resolve_storage_size): New function.
	* trans-intrinsic.c (gfc_conv_intrinsic_sizeof): Handle polymorphic
	arguments.
	(gfc_conv_intrinsic_storage_size): New function.
	(gfc_conv_intrinsic_function): Handle STORAGE_SIZE.

2010-07-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44649
	* gfortran.dg/c_sizeof_1.f90: Modified.
	* gfortran.dg/storage_size_1.f08: New.
	* gfortran.dg/storage_size_2.f08: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/storage_size_1.f08
    trunk/gcc/testsuite/gfortran.dg/storage_size_2.f08
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/c_sizeof_1.f90

Comment 3 janus 2010-07-08 21:34:25 UTC
Fixed with r161977. Closing.