public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44869]  New: [OOP] Missing TARGET check - and wrong code or accepts-invalid?
@ 2010-07-08 10:28 burnus at gcc dot gnu dot org
  2010-07-08 10:30 ` [Bug fortran/44869] " burnus at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-08 10:28 UTC (permalink / raw)
  To: gcc-bugs

Reported by Satish.BD at http://gcc.gnu.org/ml/fortran/2010-07/msg00059.html

The shown (cf. URL) program compiles without any errors, but segfaults when at
run time.


Two of my other compiles diagnosed the following failure (gfortran not):

- In line 220, the access to tst_case => self%list requires a TARGET attribute
for "self" (which is not diagnosed in gfortran). Ditto for lines 231 and 245.


One compiler additionally complained that for

-     call suite%add("first_test", test_a)
  and call self%assert(1,2, 1233 , "generic_tbp.f90", "purposely failed")
  no specific subprogram could be found  (I have not checked this)


The other compiler, compiles and the resulting program does not segfault but
prints:

FFFF
We have    4 failure(s).
   1) first_test: generic_tbp.f90:1233 purposely failed: expected <         1>
but was <         2>
   2) second_test: generic_tbp.f90: 324 purposely passed: expected <
3.50000000E+00> but was < 2.67499995E+00>
   3) third_test: generic_tbp.f90:1233 purposely failed: expected <         1>
but was <         2>
   4) last_test: generic_tbp.f90: 324 purposely passed: expected <
3.50000000E+00> but was < 2.67499995E+00>

     !!! FAILURES !!!

Runs:       4
Passes:     0
Fails:      4


-- 
           Summary: [OOP] Missing TARGET check - and wrong code or accepts-
                    invalid?
           Product: gcc
           Version: 4.6.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=44869


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

* [Bug fortran/44869] [OOP] Missing TARGET check - and wrong code or accepts-invalid?
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
@ 2010-07-08 10:30 ` burnus at gcc dot gnu dot org
  2010-07-08 10:33 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-08 10:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2010-07-08 10:29 -------
Created an attachment (id=21139)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21139&action=view)
Test case (without TARGET; corrected line breaks from the mail paste)

For the error recovery (first mail in the thread), see PR 44868


-- 


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


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

* [Bug fortran/44869] [OOP] Missing TARGET check - and wrong code or accepts-invalid?
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
  2010-07-08 10:30 ` [Bug fortran/44869] " burnus at gcc dot gnu dot org
@ 2010-07-08 10:33 ` burnus at gcc dot gnu dot org
  2010-07-09 19:02 ` janus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-08 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-07-08 10:33 -------
If one removes the comment from the line marked with

  "Uncomment this for the crash to occur"


gfortran gives an ICE:

       call tst%init()       !! Uncomment this for the crash to occur
               1
Error: Found no matching specific binding for the call to the GENERIC 'init' at
(1)
bd.f90:68:0: internal compiler error: Segmentation fault


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code


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


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

* [Bug fortran/44869] [OOP] Missing TARGET check - and wrong code or accepts-invalid?
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
  2010-07-08 10:30 ` [Bug fortran/44869] " burnus at gcc dot gnu dot org
  2010-07-08 10:33 ` burnus at gcc dot gnu dot org
@ 2010-07-09 19:02 ` janus at gcc dot gnu dot org
  2010-07-09 20:28 ` janus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-07-09 19:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janus at gcc dot gnu dot org  2010-07-09 19:02 -------
Reduced test case:


  type :: test_case
  end type 

  type :: test_suite
    type(test_case) :: list
  end type

contains

  subroutine sub(self)
    class(test_suite), intent(inout) :: self
    type(test_case), pointer :: tst_case
    tst_case => self%list
  end subroutine

end



If one changes the CLASS into a TYPE, the correct error message appears:

    tst_case => self%list
                1
Error: Pointer assignment target is neither TARGET nor POINTER at (1)


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-09 19:02:36
               date|                            |


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


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

* [Bug fortran/44869] [OOP] Missing TARGET check - and wrong code or accepts-invalid?
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-09 19:02 ` janus at gcc dot gnu dot org
@ 2010-07-09 20:28 ` janus at gcc dot gnu dot org
  2010-07-10  9:38 ` janus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-07-09 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from janus at gcc dot gnu dot org  2010-07-09 20:28 -------
Here is a fix for the target problem:

Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c       (revision 162010)
+++ gcc/fortran/primary.c       (working copy)
@@ -1999,7 +1999,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *t
   if (sym->ts.type == BT_CLASS)
     {
       dimension = CLASS_DATA (sym)->attr.dimension;
-      pointer = CLASS_DATA (sym)->attr.pointer;
+      pointer = CLASS_DATA (sym)->attr.class_pointer;
       allocatable = CLASS_DATA (sym)->attr.allocatable;
     }
   else
@@ -2059,7 +2059,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *t

        if (comp->ts.type == BT_CLASS)
          {
-           pointer = CLASS_DATA (comp)->attr.pointer;
+           pointer = CLASS_DATA (comp)->attr.class_pointer;
            allocatable = CLASS_DATA (comp)->attr.allocatable;
          }
        else
@@ -2109,7 +2109,7 @@ gfc_expr_attr (gfc_expr *e)
          if (sym->ts.type == BT_CLASS)
            {
              attr.dimension = CLASS_DATA (sym)->attr.dimension;
-             attr.pointer = CLASS_DATA (sym)->attr.pointer;
+             attr.pointer = CLASS_DATA (sym)->attr.class_pointer;
              attr.allocatable = CLASS_DATA (sym)->attr.allocatable;
            }
        }


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-07-09 19:02:36         |2010-07-09 20:28:29
               date|                            |


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


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

* [Bug fortran/44869] [OOP] Missing TARGET check - and wrong code or accepts-invalid?
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-09 20:28 ` janus at gcc dot gnu dot org
@ 2010-07-10  9:38 ` janus at gcc dot gnu dot org
  2010-07-11  8:09 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-07-10  9:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janus at gcc dot gnu dot org  2010-07-10 09:38 -------
The patch in comment #4 regresses on select_type_4.f90 in the test suite.


-- 


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


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

* [Bug fortran/44869] [OOP] Missing TARGET check - and wrong code or accepts-invalid?
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-10  9:38 ` janus at gcc dot gnu dot org
@ 2010-07-11  8:09 ` janus at gcc dot gnu dot org
  2010-07-11  8:26 ` janus at gcc dot gnu dot org
  2010-07-13  8:44 ` [Bug fortran/44869] [OOP] generic TBPs not initialized properly burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-07-11  8:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janus at gcc dot gnu dot org  2010-07-11 08:09 -------
The TARGET check is fixed by r162052:

http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162052


The runtime segfault persist.


-- 


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


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

* [Bug fortran/44869] [OOP] Missing TARGET check - and wrong code or accepts-invalid?
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-07-11  8:09 ` janus at gcc dot gnu dot org
@ 2010-07-11  8:26 ` janus at gcc dot gnu dot org
  2010-07-13  8:44 ` [Bug fortran/44869] [OOP] generic TBPs not initialized properly burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-07-11  8:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from janus at gcc dot gnu dot org  2010-07-11 08:26 -------
(In reply to comment #6)
> The runtime segfault persist.

It seems this segfault comes from the call to 'self%assert' in 'test_a'.

The dump shows

self->$vptr->assert->assert_int ((struct class$test_case *) self, &C.1978,
&C.1979, &C.1980, &"generic_tbp.f90"[1]{lb: 1 sz: 1}, &"purposely
failed"[1]{lb: 1 sz: 1}, 15, 16);

which looks ok.

The problem seems to be that the generic TBPs in the vtab are not initialized
properly. The dump contains the correct initialization code for the specific
TBPs, but the init for the generics seems to be missing.


-- 


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


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

* [Bug fortran/44869] [OOP] generic TBPs not initialized properly
  2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-07-11  8:26 ` janus at gcc dot gnu dot org
@ 2010-07-13  8:44 ` burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-13  8:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from janus at gcc dot gnu dot org  2010-07-13 06:57 -------
Subject: Bug 44869

Author: janus
Date: Tue Jul 13 06:57:17 2010
New Revision: 162125

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

        PR fortran/44434
        PR fortran/44565
        PR fortran/43945
        PR fortran/44869
        * gfortran.h (gfc_find_derived_vtab): Modified prototype.
        * class.c (gfc_build_class_symbol): Modified call to
        'gfc_find_derived_vtab'.
        (add_proc_component): Removed, moved code into 'add_proc_comp'.
        (add_proc_comps): Renamed to 'add_proc_comp', removed treatment of
        generics.
        (add_procs_to_declared_vtab1): Removed unnecessary argument 'resolved'.
        Removed treatment of generics.
        (copy_vtab_proc_comps): Removed unnecessary argument 'resolved'.
        Call 'add_proc_comp' instead of duplicating code.
        (add_procs_to_declared_vtab): Removed unnecessary arguments 'resolved'
        and 'declared'.
        (add_generic_specifics,add_generics_to_declared_vtab): Removed.
        (gfc_find_derived_vtab): Removed unnecessary argument 'resolved'.
        Removed treatment of generics.
        * iresolve.c (gfc_resolve_extends_type_of): Modified call to
        'gfc_find_derived_vtab'.
        * resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
        Removed treatment of generics.
        (resolve_select_type,resolve_fl_derived): Modified call to
        'gfc_find_derived_vtab'.
        * trans-decl.c (gfc_get_symbol_decl): Ditto.
        * trans-expr.c (gfc_conv_derived_to_class,gfc_trans_class_assign):
        Ditto.
        * trans-stmt.c (gfc_trans_allocate): Ditto.

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

        PR fortran/44434
        PR fortran/44565
        PR fortran/43945
        PR fortran/44869
        * gfortran.dg/dynamic_dispatch_1.f03: Fixed invalid test case.
        * gfortran.dg/dynamic_dispatch_2.f03: Ditto.
        * gfortran.dg/dynamic_dispatch_3.f03: Ditto.
        * gfortran.dh/typebound_call_16.f03: New.
        * gfortran.dg/typebound_generic_6.f03: New.
        * gfortran.dg/typebound_generic_7.f03: New.
        * gfortran.dg/typebound_generic_8.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_call_16.f03
    trunk/gcc/testsuite/gfortran.dg/typebound_generic_6.f03
    trunk/gcc/testsuite/gfortran.dg/typebound_generic_7.f03
    trunk/gcc/testsuite/gfortran.dg/typebound_generic_8.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/dynamic_dispatch_1.f03
    trunk/gcc/testsuite/gfortran.dg/dynamic_dispatch_2.f03
    trunk/gcc/testsuite/gfortran.dg/dynamic_dispatch_3.f03


------- Comment #9 from burnus at gcc dot gnu dot org  2010-07-13 08:44 -------
Close as FIXED. Thanks Janus for the fix and thanks to Satish.BD for the bug
report.


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-07-13  8:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08 10:28 [Bug fortran/44869] New: [OOP] Missing TARGET check - and wrong code or accepts-invalid? burnus at gcc dot gnu dot org
2010-07-08 10:30 ` [Bug fortran/44869] " burnus at gcc dot gnu dot org
2010-07-08 10:33 ` burnus at gcc dot gnu dot org
2010-07-09 19:02 ` janus at gcc dot gnu dot org
2010-07-09 20:28 ` janus at gcc dot gnu dot org
2010-07-10  9:38 ` janus at gcc dot gnu dot org
2010-07-11  8:09 ` janus at gcc dot gnu dot org
2010-07-11  8:26 ` janus at gcc dot gnu dot org
2010-07-13  8:44 ` [Bug fortran/44869] [OOP] generic TBPs not initialized properly 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).