public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33760]  New: Bind(C): Using C_PTR as structure constructor gives an ICE
@ 2007-10-13 11:05 burnus at gcc dot gnu dot org
  2007-10-17  4:01 ` [Bug fortran/33760] " patchapp at dberlin dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-13 11:05 UTC (permalink / raw)
  To: gcc-bugs

gfortran crashes if one uses

   cptr = C_PTR(p+1)

Here, C_PTR is a structure constructor; this usage is invalid Fortran 2003 (as
type(C_PTR) has PRIVATE components according to the Fortran 2003 standard); NAG
f95 therefore diagnoses:
  Error: Components of structure constructor 'c_ptr' at (1) are PRIVATE

gfortran allows currently to access the private components to allow to print
the pointer address as in
  print *, cptr
(For -std=f2003, this gives the expected error because of the private
components. However, for C_PTR(..) -std=f2003 does not help.)

Valgrind:
==15961== Invalid read of size 8
==15961==    at 0x49F466: gfc_conv_expr (trans-expr.c:3316)
==15961==    by 0x49FB9C: gfc_trans_assignment_1 (trans-expr.c:4075)
==15961==    by 0x49FDAC: gfc_trans_assignment (trans-expr.c:4222)
==15961==    by 0x482E67: gfc_trans_code (trans.c:993)
==15961==    by 0x498669: gfc_generate_function_code (trans-decl.c:3307)
==15961==    by 0x45462B: gfc_parse_file (parse.c:3384)

Test program, found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/0ea1d42c43b6d54a/

program main
   use ISO_C_BINDING
   implicit none
   integer(C_INTPTR_T) p
   type(C_PTR) cptr
   p = 0
   cptr = C_PTR(p+1)
end program main


-- 
           Summary: Bind(C): Using C_PTR as structure constructor gives an
                    ICE
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          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=33760


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

* [Bug fortran/33760] Bind(C): Using C_PTR as structure constructor gives an ICE
  2007-10-13 11:05 [Bug fortran/33760] New: Bind(C): Using C_PTR as structure constructor gives an ICE burnus at gcc dot gnu dot org
@ 2007-10-17  4:01 ` patchapp at dberlin dot org
  2007-10-17  6:57 ` burnus at gcc dot gnu dot org
  2007-10-17  6:57 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: patchapp at dberlin dot org @ 2007-10-17  4:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from patchapp at dberlin dot org  2007-10-17 04:01 -------
Subject: Bug number PR 33760

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-10/msg00925.html


-- 


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


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

* [Bug fortran/33760] Bind(C): Using C_PTR as structure constructor gives an ICE
  2007-10-13 11:05 [Bug fortran/33760] New: Bind(C): Using C_PTR as structure constructor gives an ICE burnus at gcc dot gnu dot org
  2007-10-17  4:01 ` [Bug fortran/33760] " patchapp at dberlin dot org
  2007-10-17  6:57 ` burnus at gcc dot gnu dot org
@ 2007-10-17  6:57 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-17  6:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-10-17 06:57 -------
FIXED on the trunk (4.3.0).


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/33760] Bind(C): Using C_PTR as structure constructor gives an ICE
  2007-10-13 11:05 [Bug fortran/33760] New: Bind(C): Using C_PTR as structure constructor gives an ICE burnus at gcc dot gnu dot org
  2007-10-17  4:01 ` [Bug fortran/33760] " patchapp at dberlin dot org
@ 2007-10-17  6:57 ` burnus at gcc dot gnu dot org
  2007-10-17  6:57 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-17  6:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-10-17 06:57 -------
Subject: Bug 33760

Author: burnus
Date: Wed Oct 17 06:57:06 2007
New Revision: 129402

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129402
Log:
2007-10-17 Christopher D. Rickett <crickett@lanl.gov>

        PR fortran/33760
        * symbol.c (gen_special_c_interop_ptr): Remove code to create
        constructor for c_null_ptr and c_null_funptr with value of 0.
        * expr.c (check_init_expr): Prevent check on constructors for
        iso_c_binding derived types.
        * resolve.c (resolve_structure_cons): Verify that the user isn't
        trying to invoke a structure constructor for one of the
        iso_c_binding derived types.


2007-10-17 Christopher D. Rickett <crickett@lanl.gov>

        PR fortran/33760
        * gfortran.dg/c_ptr_tests_13.f03: New test case.


Added:
    trunk/gcc/testsuite/gfortran.dg/c_ptr_tests_13.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2007-10-17  6:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-13 11:05 [Bug fortran/33760] New: Bind(C): Using C_PTR as structure constructor gives an ICE burnus at gcc dot gnu dot org
2007-10-17  4:01 ` [Bug fortran/33760] " patchapp at dberlin dot org
2007-10-17  6:57 ` burnus at gcc dot gnu dot org
2007-10-17  6:57 ` burnus at gcc dot gnu dot org

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).