public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
       [not found] <bug-40963-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-15  0:05 ` pastewka at gmail dot com
  2012-01-31  8:07 ` andrew.t.baldwin at me dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: pastewka at gmail dot com @ 2012-01-15  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

Lars Pastewka <pastewka at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pastewka at gmail dot com

--- Comment #4 from Lars Pastewka <pastewka at gmail dot com> 2012-01-14 23:50:04 UTC ---
I encountered the same bug in gfortran 4.7.0 20110329 and 4.5.2.

Are there any updates on this bug?


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

* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
       [not found] <bug-40963-4@http.gcc.gnu.org/bugzilla/>
  2012-01-15  0:05 ` [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument pastewka at gmail dot com
@ 2012-01-31  8:07 ` andrew.t.baldwin at me dot com
  2012-01-31 14:03 ` pastewka at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: andrew.t.baldwin at me dot com @ 2012-01-31  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Baldwin <andrew.t.baldwin at me dot com> 2012-01-31 04:53:40 UTC ---
(In reply to comment #4)
> I encountered the same bug in gfortran 4.7.0 20110329 and 4.5.2.
> 
> Are there any updates on this bug?

I did not encounted this bug with g++ 4.7.0 20111126, but do encounter it from
g++ 4.7.0 20111203 through g++ 4.7.0 20120128.  Hopefully that helps narrow
things down.


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

* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
       [not found] <bug-40963-4@http.gcc.gnu.org/bugzilla/>
  2012-01-15  0:05 ` [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument pastewka at gmail dot com
  2012-01-31  8:07 ` andrew.t.baldwin at me dot com
@ 2012-01-31 14:03 ` pastewka at gmail dot com
  2013-03-25 15:53 ` burnus at gcc dot gnu.org
  2013-03-25 17:48 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 8+ messages in thread
From: pastewka at gmail dot com @ 2012-01-31 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Lars Pastewka <pastewka at gmail dot com> 2012-01-31 13:24:27 UTC ---
A simple workaround for this bug seems to be:

 cptr = c_loc(obj1%array(1,1))

in the above example. It compiles and appears to be doing what it should.

Maybe that also helps narrowing it down.


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

* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
       [not found] <bug-40963-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-01-31 14:03 ` pastewka at gmail dot com
@ 2013-03-25 15:53 ` burnus at gcc dot gnu.org
  2013-03-25 17:48 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-25 15:53 UTC (permalink / raw)
  To: gcc-bugs


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org
      Known to fail|                            |

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-25 15:53:47 UTC ---
Author: burnus
Date: Mon Mar 25 15:40:26 2013
New Revision: 197053

URL: http://gcc.gnu.org/viewcvs?rev=197053&root=gcc&view=rev
Log:
2013-03-25  Tobias Burnus  <burnus@net-b.de>

        PR fortran/38536
        PR fortran/38813
        PR fortran/38894
        PR fortran/39288
        PR fortran/40963
        PR fortran/45824
        PR fortran/47023
        PR fortran/47034
        PR fortran/49023
        PR fortran/50269
        PR fortran/50612
        PR fortran/52426
        PR fortran/54263
        PR fortran/55343
        PR fortran/55444
        PR fortran/55574
        PR fortran/56079
        PR fortran/56378
        * check.c (gfc_var_strlen): Properly handle 0-sized string.
        (gfc_check_c_sizeof): Use is_c_interoperable, add checks.
        (is_c_interoperable, gfc_check_c_associated, gfc_check_c_f_pointer,
        gfc_check_c_f_procpointer, gfc_check_c_funloc, gfc_check_c_loc): New
        functions.
        * expr.c (check_inquiry): Add c_sizeof, compiler_version and
        compiler_options.
        (gfc_check_pointer_assign): Refine function result check.
        gfortran.h (gfc_isym_id): Add GFC_ISYM_C_ASSOCIATED,
        GFC_ISYM_C_F_POINTER, GFC_ISYM_C_F_PROCPOINTER, GFC_ISYM_C_FUNLOC,
        GFC_ISYM_C_LOC.
        (iso_fortran_env_symbol, iso_c_binding_symbol): Handle
        NAMED_SUBROUTINE.
        (generate_isocbinding_symbol): Update prototype.
        (get_iso_c_sym): Remove.
        (gfc_isym_id_by_intmod, gfc_isym_id_by_intmod_sym): New prototypes.
        * intrinsic.c (gfc_intrinsic_subroutine_by_id): New function.
        (gfc_intrinsic_sub_interface): Use it.
        (add_functions, add_subroutines): Add missing C-binding intrinsics.
        (gfc_intrinsic_func_interface): Add special case for c_loc.
        gfc_isym_id_by_intmod, gfc_isym_id_by_intmod_sym): New functions.
        (gfc_intrinsic_func_interface, gfc_intrinsic_sub_interface): Use them.
        * intrinsic.h (gfc_check_c_associated, gfc_check_c_f_pointer,
        gfc_check_c_f_procpointer, gfc_check_c_funloc, gfc_check_c_loc,
        gfc_resolve_c_loc, gfc_resolve_c_funloc): New prototypes.
        * iresolve.c (gfc_resolve_c_loc, gfc_resolve_c_funloc): New
        functions.
        * iso-c-binding.def: Split PROCEDURE into NAMED_SUBROUTINE and
        NAMED_FUNCTION.
        * iso-fortran-env.def: Add NAMED_SUBROUTINE for completeness.
        * module.c (create_intrinsic_function): Support subroutines and
        derived-type results.
        (use_iso_fortran_env_module): Update calls.
        (import_iso_c_binding_module): Ditto; update calls to
        generate_isocbinding_symbol.
        * resolve.c (find_arglists): Skip for intrinsic symbols.
        (gfc_resolve_intrinsic): Find intrinsic subs via id.
        (is_scalar_expr_ptr, gfc_iso_c_func_interface,
        set_name_and_label, gfc_iso_c_sub_interface): Remove.
        (resolve_function, resolve_specific_s0): Remove calls to those.
        (resolve_structure_cons): Fix handling.
        * symbol.c (gen_special_c_interop_ptr): Update c_ptr/c_funptr
        generation.
        (gen_cptr_param, gen_fptr_param, gen_shape_param,
        build_formal_args, get_iso_c_sym): Remove.
        (std_for_isocbinding_symbol): Handle NAMED_SUBROUTINE.
        (generate_isocbinding_symbol): Support hidden symbols and
        using c_ptr/c_funptr symtrees for nullptr defs.
        * target-memory.c (gfc_target_encode_expr): Fix handling
        of c_ptr/c_funptr.
        * trans-expr.c (conv_isocbinding_procedure): Remove.
        (gfc_conv_procedure_call): Remove call to it.
        (gfc_trans_subcomponent_assign, gfc_conv_expr): Update handling
        of c_ptr/c_funptr.
        * trans-intrinsic.c (conv_isocbinding_function,
        conv_isocbinding_subroutine): New.
        (gfc_conv_intrinsic_function, gfc_conv_intrinsic_subroutine):
        Call them.
        * trans-io.c (transfer_expr): Fix handling of c_ptr/c_funptr.
        * trans-types.c (gfc_typenode_for_spec,
        gfc_get_derived_type): Ditto.
        (gfc_init_c_interop_kinds): Handle NAMED_SUBROUTINE.

2013-03-25  Tobias Burnus  <burnus@net-b.de>

        PR fortran/38536
        PR fortran/38813
        PR fortran/38894
        PR fortran/39288
        PR fortran/40963
        PR fortran/45824
        PR fortran/47023
        PR fortran/47034
        PR fortran/49023
        PR fortran/50269
        PR fortran/50612
        PR fortran/52426
        PR fortran/54263
        PR fortran/55343
        PR fortran/55444
        PR fortran/55574
        PR fortran/56079
        PR fortran/56378
        * gfortran.dg/c_assoc_2.f03: Update dg-error wording.
        * gfortran.dg/c_f_pointer_shape_test.f90: Ditto.
        * gfortran.dg/c_f_pointer_shape_tests_3.f03: Ditto.
        * gfortran.dg/c_f_pointer_tests_5.f90: Ditto.
        * gfortran.dg/c_funloc_tests_2.f03: Ditto.
        * gfortran.dg/c_funloc_tests_5.f03: Ditto.
        * gfortran.dg/c_funloc_tests_6.f90: Ditto.
        * gfortran.dg/c_loc_tests_10.f03: Add -std=f2008.
        * gfortran.dg/c_loc_tests_11.f03: Ditto, update dg-error.
        * gfortran.dg/c_loc_tests_16.f90: Ditto.
        * gfortran.dg/c_loc_tests_4.f03: Ditto.
        * gfortran.dg/c_loc_tests_15.f90: Update dg-error wording.
        * gfortran.dg/c_loc_tests_3.f03: Valid since F2003 TC5.
        * gfortran.dg/c_loc_tests_8.f03: Ditto.
        * gfortran.dg/c_ptr_tests_14.f90: Update scan-tree-dump-times.
        * gfortran.dg/c_ptr_tests_15.f90: Ditto.
        * gfortran.dg/c_sizeof_1.f90: Fix invalid code.
        * gfortran.dg/iso_c_binding_init_expr.f03: Update dg-error wording.
        * gfortran.dg/pr32601_1.f03: Ditto.
        * gfortran.dg/storage_size_2.f08: Remove dg-error.
        * gfortran.dg/blockdata_7.f90: New.
        * gfortran.dg/c_assoc_4.f90: New.
        * gfortran.dg/c_f_pointer_tests_6.f90: New.
        * gfortran.dg/c_f_pointer_tests_7.f90: New.
        * gfortran.dg/c_funloc_tests_8.f90: New.
        * gfortran.dg/c_loc_test_17.f90: New.
        * gfortran.dg/c_loc_test_18.f90: New.
        * gfortran.dg/c_loc_test_19.f90: New.
        * gfortran.dg/c_loc_test_20.f90: New.
        * gfortran.dg/c_sizeof_5.f90: New.
        * gfortran.dg/iso_c_binding_rename_3.f90: New.
        * gfortran.dg/transfer_resolve_2.f90: New.
        * gfortran.dg/transfer_resolve_3.f90: New.
        * gfortran.dg/transfer_resolve_4.f90: New.
        * gfortran.dg/pr32601.f03: Update dg-error.
        * gfortran.dg/c_ptr_tests_13.f03: Update dg-error.
        * gfortran.dg/c_ptr_tests_9.f03: Fix test case.


Added:
    trunk/gcc/testsuite/gfortran.dg/blockdata_7.f90
    trunk/gcc/testsuite/gfortran.dg/c_assoc_4.f90
    trunk/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
    trunk/gcc/testsuite/gfortran.dg/c_f_pointer_tests_7.f90
    trunk/gcc/testsuite/gfortran.dg/c_funloc_tests_8.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_test_17.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_test_18.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_test_19.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_test_20.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_17.f90
    trunk/gcc/testsuite/gfortran.dg/c_sizeof_5.f90
    trunk/gcc/testsuite/gfortran.dg/iso_c_binding_rename_3.f90
    trunk/gcc/testsuite/gfortran.dg/transfer_resolve_2.f90
    trunk/gcc/testsuite/gfortran.dg/transfer_resolve_3.f90
    trunk/gcc/testsuite/gfortran.dg/transfer_resolve_4.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/iso-c-binding.def
    trunk/gcc/fortran/iso-fortran-env.def
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/fortran/target-memory.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/fortran/trans-io.c
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/c_assoc_2.f03
    trunk/gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90
    trunk/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_3.f03
    trunk/gcc/testsuite/gfortran.dg/c_f_pointer_tests_5.f90
    trunk/gcc/testsuite/gfortran.dg/c_funloc_tests_2.f03
    trunk/gcc/testsuite/gfortran.dg/c_funloc_tests_5.f03
    trunk/gcc/testsuite/gfortran.dg/c_funloc_tests_6.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_10.f03
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_11.f03
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_15.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_16.f90
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_3.f03
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_4.f03
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_8.f03
    trunk/gcc/testsuite/gfortran.dg/c_ptr_tests_13.f03
    trunk/gcc/testsuite/gfortran.dg/c_ptr_tests_14.f90
    trunk/gcc/testsuite/gfortran.dg/c_ptr_tests_15.f90
    trunk/gcc/testsuite/gfortran.dg/c_ptr_tests_9.f03
    trunk/gcc/testsuite/gfortran.dg/c_sizeof_1.f90
    trunk/gcc/testsuite/gfortran.dg/iso_c_binding_init_expr.f03
    trunk/gcc/testsuite/gfortran.dg/pr32601.f03
    trunk/gcc/testsuite/gfortran.dg/pr32601_1.f03
    trunk/gcc/testsuite/gfortran.dg/storage_size_2.f08


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

* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
       [not found] <bug-40963-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-03-25 15:53 ` burnus at gcc dot gnu.org
@ 2013-03-25 17:48 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-25 17:48 UTC (permalink / raw)
  To: gcc-bugs


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-25 17:48:34 UTC ---
FIXED on the 4.9 trunk.

Thanks for the report - and sorry for taking that long to fix it.


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

* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
  2009-08-04 15:21 [Bug fortran/40963] New: " rohou at brandeis dot edu
  2009-08-04 15:22 ` [Bug fortran/40963] " rohou at brandeis dot edu
  2009-08-04 16:14 ` burnus at gcc dot gnu dot org
@ 2010-05-16 20:25 ` dfranke at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-16 20:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2010-05-16 20:24 -------
*** Bug 44155 has been marked as a duplicate of this bug. ***


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |whalen at cray dot com


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


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

* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
  2009-08-04 15:21 [Bug fortran/40963] New: " rohou at brandeis dot edu
  2009-08-04 15:22 ` [Bug fortran/40963] " rohou at brandeis dot edu
@ 2009-08-04 16:14 ` burnus at gcc dot gnu dot org
  2010-05-16 20:25 ` dfranke at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-04 16:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-08-04 16:14 -------
The issue is that the expression is an array ("expr->rank > 0") but the symbol
itself is not, only it's component.


==16545== Invalid read of size 4
==16545==    at 0x55343F: gfc_conv_procedure_call (trans-expr.c:2441)
==16545==    by 0x547595F: ???
==16545==    by 0x4FBD06: gfc_match_actual_arglist (primary.c:1670)

That's the last line in:

      if (sym->intmod_sym_id == ISOCBINDING_LOC)
[...]
          if (arg->expr->rank == 0)
            gfc_conv_expr_reference (se, arg->expr);
          else
            {[...]
              /* We should want it to do g77 calling convention.  */
              f = (fsym != NULL)
                && !(fsym->attr.pointer || fsym->attr.allocatable)
                && fsym->as->type != AS_ASSUMED_SHAPE;


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-04 16:14:31
               date|                            |


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


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

* [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument
  2009-08-04 15:21 [Bug fortran/40963] New: " rohou at brandeis dot edu
@ 2009-08-04 15:22 ` rohou at brandeis dot edu
  2009-08-04 16:14 ` burnus at gcc dot gnu dot org
  2010-05-16 20:25 ` dfranke at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: rohou at brandeis dot edu @ 2009-08-04 15:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rohou at brandeis dot edu  2009-08-04 15:22 -------
Created an attachment (id=18299)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18299&action=view)
Source file to cause the segfault

I used option -save-temps, but could not find a *.i file, so I have attached
the *.f90 file instead.


-- 


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


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

end of thread, other threads:[~2013-03-25 17:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-40963-4@http.gcc.gnu.org/bugzilla/>
2012-01-15  0:05 ` [Bug fortran/40963] ICE segfault - c_loc with derived type component as argument pastewka at gmail dot com
2012-01-31  8:07 ` andrew.t.baldwin at me dot com
2012-01-31 14:03 ` pastewka at gmail dot com
2013-03-25 15:53 ` burnus at gcc dot gnu.org
2013-03-25 17:48 ` burnus at gcc dot gnu.org
2009-08-04 15:21 [Bug fortran/40963] New: " rohou at brandeis dot edu
2009-08-04 15:22 ` [Bug fortran/40963] " rohou at brandeis dot edu
2009-08-04 16:14 ` burnus at gcc dot gnu dot org
2010-05-16 20:25 ` dfranke 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).