public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67817] New: Missing compilation error for some wrong conversions in data
@ 2015-10-02 14:10 gerhard.steinmetz.fortran@t-online.de
  2015-10-02 14:11 ` [Bug fortran/67817] " gerhard.steinmetz.fortran@t-online.de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-02 14:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67817

            Bug ID: 67817
           Summary: Missing compilation error for some wrong conversions
                    in data
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fortran@t-online.de
  Target Milestone: ---

For the following cases an error message should be given.
Rejection makes it comparable to other ways of initialization.
(add-on to PR67804)


$ cat z1.f90
program p
   type t
      real :: a
   end type
   type(t) :: x6, x8
   data x6 /t(.true.)/
   data x8 /t('1')/
   print *, x6
   print *, x8
end

$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z1.f90
$ a.out
   1.40129846E-45
   6.86636248E-44


---

Here, relevant errors are detected :

$ cat z2.f90
program p
   real :: x6, x8
   data x6 /.true./
   data x8 /'1'/
end

$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z2.f90
z2.f90:4:7:

    data x8 /'1'/
       1
Error: Incompatible types in DATA statement at (1); attempted conversion of
CHARACTER(1) to REAL(4)
z2.f90:3:7:

    data x6 /.true./
       1
Error: Incompatible types in DATA statement at (1); attempted conversion of
LOGICAL(4) to REAL(4)

---

$ cat z3.f90
program p
   type t
      real :: a
   end type
   type(t), parameter :: x6 = t(.true.)
   type(t), parameter :: x8 = t('1')
end

$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z3.f90
z3.f90:5:32:

    type(t), parameter :: x6 = t(.true.)
                                1
Error: Can't convert LOGICAL(4) to REAL(4) at (1)
z3.f90:6:32:

    type(t), parameter :: x8 = t('1')
                                1
Error: Can't convert CHARACTER(1) to REAL(4) at (1)


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

* [Bug fortran/67817] Missing compilation error for some wrong conversions in data
  2015-10-02 14:10 [Bug fortran/67817] New: Missing compilation error for some wrong conversions in data gerhard.steinmetz.fortran@t-online.de
@ 2015-10-02 14:11 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-09 12:18 ` dominiq at lps dot ens.fr
  2022-03-18 19:54 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-02 14:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67817

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
More examples analogous to z1.f90 :


$ cat z4.f90
program p
   type t
      complex :: a
   end type
   type(t) :: x6, x8
   data x6 /t(.true.)/
   data x8 /t('1')/
end


$ cat z5.f90
program p
   type t
      integer :: a
   end type
   type(t) :: x6, x8
   data x6 /t(.true.)/
   data x8 /t('1')/
end


$ cat z6.f90
program p
   type t
      logical :: a
   end type
   type(t) :: x1, x2, x3, x4, x8
   data x1 /t(1)/
   data x2 /t(1.)/
   data x3 /t(1d0)/
   data x4 /t((0.,1.))/
   data x8 /t('1')/
   print *, x1
   print *, x2
   print *, x3
   print *, x4
   print *, x8
end


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

* [Bug fortran/67817] Missing compilation error for some wrong conversions in data
  2015-10-02 14:10 [Bug fortran/67817] New: Missing compilation error for some wrong conversions in data gerhard.steinmetz.fortran@t-online.de
  2015-10-02 14:11 ` [Bug fortran/67817] " gerhard.steinmetz.fortran@t-online.de
@ 2015-10-09 12:18 ` dominiq at lps dot ens.fr
  2022-03-18 19:54 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-09 12:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67817

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-09
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0).


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

* [Bug fortran/67817] Missing compilation error for some wrong conversions in data
  2015-10-02 14:10 [Bug fortran/67817] New: Missing compilation error for some wrong conversions in data gerhard.steinmetz.fortran@t-online.de
  2015-10-02 14:11 ` [Bug fortran/67817] " gerhard.steinmetz.fortran@t-online.de
  2015-10-09 12:18 ` dominiq at lps dot ens.fr
@ 2022-03-18 19:54 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-03-18 19:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67817

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from anlauf at gcc dot gnu.org ---
Dup.

*** This bug has been marked as a duplicate of bug 67804 ***

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

end of thread, other threads:[~2022-03-18 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02 14:10 [Bug fortran/67817] New: Missing compilation error for some wrong conversions in data gerhard.steinmetz.fortran@t-online.de
2015-10-02 14:11 ` [Bug fortran/67817] " gerhard.steinmetz.fortran@t-online.de
2015-10-09 12:18 ` dominiq at lps dot ens.fr
2022-03-18 19:54 ` anlauf at gcc dot gnu.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).