public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual
@ 2013-10-18 18:18 vladimir.fuka at gmail dot com
  2013-10-18 19:17 ` [Bug fortran/58793] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vladimir.fuka at gmail dot com @ 2013-10-18 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58793
           Summary: Wrong storage_size of class(*) dummy argument with
                    complex actual
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vladimir.fuka at gmail dot com

Complex variable has storage size of only real a variable when passed as
class(*).

module m
contains
 subroutine s(o)
    class(*) :: o

    write (*,*) storage_size(o)
    select type (o)
      type is (complex)
        print *,storage_size(o)
      type is (complex(8))
        print *,storage_size(o)
      type is (complex(16))
        print *,storage_size(o)
    end select
  end 
end

program p
 use m
 call s((1._4,2._4))
 call s((1._8,2._8))
 call s((1._16,2._16))
end

gcc version 4.8.2 20131003


Expected output:
          64
          64
         128
         128
         256
         256


Actual output:
          32
          64
          64
         128
         128
         256


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

* [Bug fortran/58793] Wrong storage_size of class(*) dummy argument with complex actual
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
@ 2013-10-18 19:17 ` burnus at gcc dot gnu.org
  2013-10-18 19:40 ` [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-18 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-18
                 CC|                            |burnus at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Confirmed. Patch:

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index be4959a..8d911bb 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -2504,5 +2504,7 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts)
           else
         c->initializer = gfc_get_int_expr (gfc_default_integer_kind,
-                           NULL, ts->kind);
+                           NULL,
+                           ts->type == BT_COMPLEX
+                           ? 2*ts->kind : ts->kind);

           /* Add component _extends.  */


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
  2013-10-18 19:17 ` [Bug fortran/58793] " burnus at gcc dot gnu.org
@ 2013-10-18 19:40 ` burnus at gcc dot gnu.org
  2013-10-19  5:41 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-18 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org
            Summary|Wrong storage_size of       |Wrong value for _vtab for
                   |class(*) dummy argument     |intrinsic types with
                   |with complex actual         |CLASS(*): storage_size of
                   |                            |class(*) gives wrong result

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Actually, that patch is wrong: The expected values are for
KIND / REAL / COMPLEX
4    32   64
8    64  128
10  128  256 <<
16  128  256

And the marked line one cannot get from the kind number. The proper way it use
use target-memory.c's size_complex() - which is not publicly exported. There is
gfc_element_size, but that operates on an expression and not on a type spec.


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
  2013-10-18 19:17 ` [Bug fortran/58793] " burnus at gcc dot gnu.org
  2013-10-18 19:40 ` [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result burnus at gcc dot gnu.org
@ 2013-10-19  5:41 ` burnus at gcc dot gnu.org
  2013-10-19 22:04 ` pault at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-19  5:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 31048
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31048&action=edit
Test case


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-19  5:41 ` burnus at gcc dot gnu.org
@ 2013-10-19 22:04 ` pault at gcc dot gnu.org
  2013-10-23  5:44 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu.org @ 2013-10-19 22:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 31054
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31054&action=edit
Fix for the PR

This combines a rather obvious fix with Tobias' testcase.

I'll submit tomorrow.

Paul


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
                   ` (3 preceding siblings ...)
  2013-10-19 22:04 ` pault at gcc dot gnu.org
@ 2013-10-23  5:44 ` burnus at gcc dot gnu.org
  2013-10-23  6:01 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-23  5:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Author: burnus
Date: Wed Oct 23 05:44:02 2013
New Revision: 203945

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

        PR fortran/58793
        * interface.c (compare_parameter): Reject passing TYPE(*)
        to CLASS(*).

2013-10-23  Tobias Burnus  <burnus@net-b.de>

        PR fortran/58793
        * gfortran.dg/assumed_type_8.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/assumed_type_8.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
                   ` (4 preceding siblings ...)
  2013-10-23  5:44 ` burnus at gcc dot gnu.org
@ 2013-10-23  6:01 ` burnus at gcc dot gnu.org
  2013-10-29 20:45 ` pault at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-23  6:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Paul Thomas from comment #5)
> Created attachment 31054 [details] -  Fix for the PR

which was committed as follows. Comment 6 is about one side issue found during
review; pending is a patch for another side issue: Holleriths.


Author: pault
Date: Tue Oct 22 04:40:57 2013
New Revision: 203915

URL: http://gcc.gnu.org/viewcvs?rev=203915&root=gcc&view=rev
Log:
2013-10-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran 57893
    * class.c : Include target-memory.h.
    (gfc_find_intrinsic_vtab) Build a minimal expression so that
    gfc_element_size can be used to obtain the storage size, rather
    that the kind value.

2013-10-22  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran 57893
    * gfortran.dg/unlimited_polymorphic_13.f90 : New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/unlimited_polymorphic_13.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
                   ` (5 preceding siblings ...)
  2013-10-23  6:01 ` burnus at gcc dot gnu.org
@ 2013-10-29 20:45 ` pault at gcc dot gnu.org
  2013-10-29 20:48 ` pault at gcc dot gnu.org
  2014-03-17  9:25 ` schwab@linux-m68k.org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu.org @ 2013-10-29 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

Bug 58793 depends on bug 58858, which changed state.

Bug 58858 Summary: gfortran.dg/assumed_type_8.f90 fails
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58858

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


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
                   ` (6 preceding siblings ...)
  2013-10-29 20:45 ` pault at gcc dot gnu.org
@ 2013-10-29 20:48 ` pault at gcc dot gnu.org
  2014-03-17  9:25 ` schwab@linux-m68k.org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu.org @ 2013-10-29 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
Fixed on trunk.

Thanks for the patch

Paul


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

* [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result
  2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
                   ` (7 preceding siblings ...)
  2013-10-29 20:48 ` pault at gcc dot gnu.org
@ 2014-03-17  9:25 ` schwab@linux-m68k.org
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2014-03-17  9:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58793
Bug 58793 depends on bug 58851, which changed state.

Bug 58851 Summary: FAIL: gfortran.dg/unlimited_polymorphic_13.f90  -O0  execution test
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58851

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


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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-18 18:18 [Bug fortran/58793] New: Wrong storage_size of class(*) dummy argument with complex actual vladimir.fuka at gmail dot com
2013-10-18 19:17 ` [Bug fortran/58793] " burnus at gcc dot gnu.org
2013-10-18 19:40 ` [Bug fortran/58793] Wrong value for _vtab for intrinsic types with CLASS(*): storage_size of class(*) gives wrong result burnus at gcc dot gnu.org
2013-10-19  5:41 ` burnus at gcc dot gnu.org
2013-10-19 22:04 ` pault at gcc dot gnu.org
2013-10-23  5:44 ` burnus at gcc dot gnu.org
2013-10-23  6:01 ` burnus at gcc dot gnu.org
2013-10-29 20:45 ` pault at gcc dot gnu.org
2013-10-29 20:48 ` pault at gcc dot gnu.org
2014-03-17  9:25 ` schwab@linux-m68k.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).