User account creation filtered due to spam.

Bug 40571 - F2008: ISO_FORTRAN_ENV: Missing constants
Summary: F2008: ISO_FORTRAN_ENV: Missing constants
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 44856
Blocks: 39627
  Show dependency treegraph
 
Reported: 2009-06-27 19:43 UTC by Tobias Burnus
Modified: 2010-09-24 05:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-07-05 09:16:10


Attachments
Draft patch for kinds (2.02 KB, patch)
2010-07-07 10:09 UTC, Tobias Burnus
Details | Diff
Test case (529 bytes, text/plain)
2010-07-07 15:20 UTC, Tobias Burnus
Details
New draft patch (3.14 KB, patch)
2010-09-06 14:52 UTC, Tobias Burnus
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2009-06-27 19:43:17 UTC
For the missing inquiry function, see PR 40569.

Do not forget to update intrinsic.texi!

Missing are the following integer arrays/scalars:


CHARACTER_KINDS
  [ 1, 4 ]

INTEGER_KINDS
  [ 1, 2, 4 ...]

LOGICAL_KINDS
  [ 1, 2, 4, ...]

REAL_KINDS
  [ 4, 8, ... ]


IO_INQUIRE_INTERNAL_UNIT
  some positive number which cannot appear for any
  other error as value for IOSTAT=

STAT_STOPPED_IMAGE
  positive, /= IO_INQUIRE_INTERNAL_UNIT
  Different from other STAT= values which appear for
  STAT= in ALLOCATE/DEALLOCATE and in
  SYNC ALL/IMAGES/MEMORY.
Comment 1 Tobias Burnus 2010-07-07 10:09:20 UTC
Created attachment 21122 [details]
Draft patch for kinds

Some constants such as GFC_STAT_STOPPED_IMAGE have been added as part of the coarray work. Besides the compiler_*() functions (PR 40569), the coarray LOCK_* types are missing.

To this patch: It adds support for the *_kinds parameter arrays.
TODO:

a) It does not fully work, while the following is OK
   print *, (real_kinds), shape(real_kinds)
without (), it gives a linker error:
   print *, real_kinds
namely: undefined reference to `__iso_fortran_env_MOD_integer_kinds'

b) The .texi changes are missing
Comment 2 Tobias Burnus 2010-07-07 15:20:05 UTC
Created attachment 21126 [details]
Test case
Comment 3 Tobias Burnus 2010-07-07 15:24:35 UTC
See PR 44856 for the reason why it fails for some expressions.
Comment 4 Tobias Burnus 2010-09-06 14:52:21 UTC
Created attachment 21712 [details]
New draft patch

New draft patch.

New: Documentation added; "REAL_KINDS" and "REAL_KINDS(1)" works now.

TODO
- The test case in the file, i.e. "REAL(REAL_KINDS(1))" fails with "Error: Constant expression required"
- Include attachment 21126 [details] as test case
Comment 5 Tobias Burnus 2010-09-06 17:55:25 UTC
More failures:

use iso_fortran_env
integer :: i
print *, shape(real_kinds(1))  ! should be rejected (scalar)
i = real_kinds(1)              ! ICE
end

Thus, the FE has problems if one takes a REF of an EXPR_ARRAY, i.e. the shape does not get updated.
Comment 6 Tobias Burnus 2010-09-24 05:42:10 UTC
Author: burnus
Date: Fri Sep 24 05:42:03 2010
New Revision: 164581

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164581
Log:
2010-09-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40571
        * iso-fortran-env.def: Add NAMED_KINDARRAY with
        character_kinds, integer_kinds, logical_kinds and
        real_kinds.
        * gfortran.h: Add them to iso_fortran_env_symbol.
        * libgfortran.h: Rename GFC_INQUIRE_INTERNAL_UNIT to
        LIBERROR_INQUIRE_INTERNAL_UNIT and move it from
        libgfortran_stat_codes to libgfortran_error_codes.
        * module.c (create_int_parameter_array): New function.
        (use_iso_fortran_env_module): Use it for
        NAMED_KINDARRAY of iso-fortran-env.def.
        * trans-decl.c (gfc_get_symbol_decl): Parameter
        arrays of intrinsics modules become local static variables.
        * intrinsic.texi (ISO_FORTRAN_ENV): Add character_kinds,
        integer_kinds, logical_kinds and real_kinds.

2010-09-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40571
        * gfortran.dg/iso_fortran_env_7.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/iso_fortran_env_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/fortran/iso-fortran-env.def
    trunk/gcc/fortran/libgfortran.h
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog
Comment 7 Tobias Burnus 2010-09-24 05:47:22 UTC
TODO: LOCK_TYPE. I will track it as part of PR 18918 (Coarrays).

Thus: CLOSE as FIXED: