public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42354]  New: Invalidly accepts C_LOC in init expressions
@ 2009-12-11 23:55 burnus at gcc dot gnu dot org
  2009-12-12 11:12 ` [Bug fortran/42354] " dfranke at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-12-11 23:55 UTC (permalink / raw)
  To: gcc-bugs

gfortran currently treats C_LOC as suitable for initialization expressions;
however, it does not seem to be valid in either Fortran 2003 nor Fortran 2008. 

use iso_c_binding
implicit none
integer, target :: a
type t
  type(c_ptr) :: ptr = c_loc(a)
end type t
type(c_ptr) :: ptr2 = c_loc(a)
end


F2003 has:

"7.1.7 Initialization expression"
"It is an expression in which each operation is intrinsic, and each primary is
[...] (8) A specification inquiry [...]"

Similarly in F2008's "7.1.12 Constant expression".

The definition for "specification inquiry" is in Fortran 2008 (7.1.11
Specification expression):
"A speci\fcation inquiry is a reference to
(1) an intrinsic inquiry function,
[...]
(4) the function C_SIZEOF from the intrinsic module ISO C BINDING (15.2.3.7)"

Fortran 2003 is even more restrictive (cf. 7.1.6 Specification expression),
which rules out that C_LOC can be used.

In principle, I would claim that C_LOC matches "(1) an intrinsic inquiry
function"; however, as (3), (4) and (5) explicitly list suitable functions from
the modules, I think one has to rule that it is also invalid in F2008 and not
only in F2003.


-- 
           Summary: Invalidly accepts C_LOC in init expressions
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42354


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/42354] Invalidly accepts C_LOC in init expressions
  2009-12-11 23:55 [Bug fortran/42354] New: Invalidly accepts C_LOC in init expressions burnus at gcc dot gnu dot org
@ 2009-12-12 11:12 ` dfranke at gcc dot gnu dot org
  2009-12-14 19:11 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-12 11:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2009-12-12 11:12 -------
Confirmed. Will have a quick poke at it.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-12 11:12:29
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42354


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/42354] Invalidly accepts C_LOC in init expressions
  2009-12-11 23:55 [Bug fortran/42354] New: Invalidly accepts C_LOC in init expressions burnus at gcc dot gnu dot org
  2009-12-12 11:12 ` [Bug fortran/42354] " dfranke at gcc dot gnu dot org
@ 2009-12-14 19:11 ` dfranke at gcc dot gnu dot org
  2009-12-14 19:23 ` dfranke at gcc dot gnu dot org
  2009-12-22 17:57 ` hjl dot tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-14 19:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2009-12-14 19:11 -------
Subject: Bug 42354

Author: dfranke
Date: Mon Dec 14 19:10:56 2009
New Revision: 155234

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155234
Log:
gcc/fortran/:
2009-12-14  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/42354
        * expr.c (check_init_expr): Do not check for specification functions.

gcc/testsuite/:
2009-12-14  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/42354
        * gfortran.dg/iso_c_binding_init_expr.f03: New.
        * gfortran.dg/intrinsic_std_1.f90: Fixed expected error message.
        * gfortran.dg/function_kinds_5.f90: Likewise.
        * gfortran.dg/selected_char_kind_3.f90: Likewise.


Added:
    trunk/gcc/testsuite/gfortran.dg/iso_c_binding_init_expr.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/function_kinds_5.f90
    trunk/gcc/testsuite/gfortran.dg/intrinsic_std_1.f90
    trunk/gcc/testsuite/gfortran.dg/selected_char_kind_3.f90


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42354


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/42354] Invalidly accepts C_LOC in init expressions
  2009-12-11 23:55 [Bug fortran/42354] New: Invalidly accepts C_LOC in init expressions burnus at gcc dot gnu dot org
  2009-12-12 11:12 ` [Bug fortran/42354] " dfranke at gcc dot gnu dot org
  2009-12-14 19:11 ` dfranke at gcc dot gnu dot org
@ 2009-12-14 19:23 ` dfranke at gcc dot gnu dot org
  2009-12-22 17:57 ` hjl dot tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-14 19:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2009-12-14 19:22 -------
Fixed in trunk. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42354


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/42354] Invalidly accepts C_LOC in init expressions
  2009-12-11 23:55 [Bug fortran/42354] New: Invalidly accepts C_LOC in init expressions burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-12-14 19:23 ` dfranke at gcc dot gnu dot org
@ 2009-12-22 17:57 ` hjl dot tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-12-22 17:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42354


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-22 17:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-11 23:55 [Bug fortran/42354] New: Invalidly accepts C_LOC in init expressions burnus at gcc dot gnu dot org
2009-12-12 11:12 ` [Bug fortran/42354] " dfranke at gcc dot gnu dot org
2009-12-14 19:11 ` dfranke at gcc dot gnu dot org
2009-12-14 19:23 ` dfranke at gcc dot gnu dot org
2009-12-22 17:57 ` hjl dot tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).