public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paul.richard.thomas at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/58851] FAIL: gfortran.dg/unlimited_polymorphic_13.f90  -O0  execution test
Date: Wed, 23 Oct 2013 20:39:00 -0000	[thread overview]
Message-ID: <bug-58851-4-G7HkphFPAi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58851-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
I had changed the testcase to:

! { dg-do run }
!
! PR fortran/58793
!
! Contributed by  Vladimir Fuka
!
! Had the wrong value for the storage_size for complex
!
module m
  use iso_fortran_env
  implicit none
  integer, parameter :: c1 = real_kinds(1)
  integer, parameter :: c2 = real_kinds(2)
  integer, parameter :: c3 = real_kinds(size(real_kinds)-1)
  integer, parameter :: c4 = real_kinds(size(real_kinds))
  real(c1) :: r1
  real(c2) :: r2
  real(c3) :: r3
  real(c4) :: r4
contains
 subroutine s(o, k)
    class(*) :: o
    integer :: k
    integer :: sz

    select case (k)
     case (4)
      sz = storage_size(r1)*2
     case (8)
      sz = storage_size(r2)*2
     case (10)
      sz = storage_size(r3)*2
     case (16)
      sz = storage_size(r4)*2
     case default
       call abort()
    end select

    if (storage_size(o) /= sz) call abort()
    select type (o)
      type is (complex(c1))
        if (storage_size(o) /= sz) call abort()
      type is (complex(c2))
        if (storage_size(o) /= sz) call abort()
      type is (complex(c3))
        if (storage_size(o) /= sz) call abort()
      type is (complex(c4))
        if (storage_size(o) /= sz) call abort()
    end select
  end subroutine s
end module m

program p
 use m
 call s((1._c1, 2._c1), c1)
 call s((1._c2, 2._c2), c2)
 call s((1._c3, 2._c3), c3)
 call s((1._c4, 2._c4), c4)
end program p

Is it not the case that the select type (o) is unnecessary for the test?

That is ' if (storage_size(o) /= sz) call abort()' is all that is needed?

Cheers

Paul

On 23 October 2013 17:44, burnus at gcc dot gnu.org
<gcc-bugzilla@gcc.gnu.org> wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58851
>
> Tobias Burnus <burnus at gcc dot gnu.org> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |burnus at gcc dot gnu.org
>
> --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> How about the following (untested)? It has a bit less coverage but hopefully it
> is still sufficient. Additionally, it should be portable.
>
> --- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_13.f90
> +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_13.f90
> @@ -20,0 +21,8 @@ contains
> +    real(c1) :: rc1
> +    real(c2) :: rc2
> +    real(c3) :: rc3
> +    real(c4) :: rc4
> +    complex(c1) :: cc1
> +    complex(c2) :: cc2
> +    complex(c3) :: cc3
> +    complex(c4) :: cc4
> @@ -22,10 +30,14 @@ contains
> -    select case (k)
> -     case (4)
> -      sz = 32*2
> -     case (8)
> -      sz = 64*2
> -     case (10,16)
> -      sz = 128*2
> -     case default
> -       call abort()
> -    end select
> +    if (k == c1) then
> +      sz = storage_size(cc1)
> +      if (sz /= 2*storage_size(rc1)) call abort()
> +    elseif (k == c2) then
> +      sz = storage_size(cc2)
> +      if (sz /= 2*storage_size(rc2)) call abort()
> +    elseif (k == c3) then
> +      sz = storage_size(cc3)
> +      if (sz /= 2*storage_size(rc3)) call abort()
> +    elseif (k == c4) then
> +      sz = storage_size(cc4)
> +      if (sz /= 2*storage_size(rc4)) call abort()
> +    endif
> +    if (sz < 2) call abort()
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
> You are the assignee for the bug.


  parent reply	other threads:[~2013-10-23 20:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-58851-4@http.gcc.gnu.org/bugzilla/>
2013-10-23 11:29 ` pault at gcc dot gnu.org
2013-10-23 15:44 ` burnus at gcc dot gnu.org
2013-10-23 20:39 ` paul.richard.thomas at gmail dot com [this message]
2013-10-23 20:57 ` burnus at gcc dot gnu.org
2013-10-25  9:12 ` paul.richard.thomas at gmail dot com
2013-10-30  9:23 ` schwab@linux-m68k.org
2013-10-30  9:42 ` paul.richard.thomas at gmail dot com
2013-11-02 22:18 ` schwab@linux-m68k.org
2013-11-04 18:41 ` burnus at gcc dot gnu.org
2013-11-04 19:15 ` paul.richard.thomas at gmail dot com
2013-11-04 20:47 ` schwab@linux-m68k.org
2013-11-04 21:28 ` burnus at gcc dot gnu.org
2013-11-04 22:23 ` schwab@linux-m68k.org
2014-03-17  9:23 ` schwab at gcc dot gnu.org
2014-03-17  9:25 ` schwab@linux-m68k.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58851-4-G7HkphFPAi@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).