public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96319] New: Don't warn for LOGICAL kind conversion with -Wconversion
@ 2020-07-25 19:24 jb at gcc dot gnu.org
  2020-07-26  8:38 ` [Bug fortran/96319] " tkoenig at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jb at gcc dot gnu.org @ 2020-07-25 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96319
           Summary: Don't warn for LOGICAL kind conversion with
                    -Wconversion
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jb at gcc dot gnu.org
  Target Milestone: ---

From
https://stackoverflow.com/questions/62937435/compilation-warning-with-gfortran-on-assignment-of-logicalc-bool-variable

Consider the program

PROGRAM boolean
   USE ISO_C_BINDING
   IMPLICIT NONE
   LOGICAL (KIND = C_BOOL) :: cbool
   INTEGER :: i, j
   i = 1
   j = 2
   cbool = i /= j
   WRITE(*,*) cbool
END PROGRAM boolean

Compiling with

gfortran boolean.f90 -o boolean -Wall

results in the warning

boolean.f90:8:11:

    8 |    cbool = i /= j
      |           1
Warning: Possible change of value in conversion from LOGICAL(4) to LOGICAL(1)
at (1) [-Wconversion]


The warning is incorrect here as there's only one value bit in the LOGICAL
variable regardless of the kind, and thus there is no risk of losing data even
if this is a narrowing conversion.

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

* [Bug fortran/96319] Don't warn for LOGICAL kind conversion with -Wconversion
  2020-07-25 19:24 [Bug fortran/96319] New: Don't warn for LOGICAL kind conversion with -Wconversion jb at gcc dot gnu.org
@ 2020-07-26  8:38 ` tkoenig at gcc dot gnu.org
  2020-07-28 17:11 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-07-26  8:38 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-26
           Keywords|                            |diagnostic, easyhack

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Sounds easy enough.

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

* [Bug fortran/96319] Don't warn for LOGICAL kind conversion with -Wconversion
  2020-07-25 19:24 [Bug fortran/96319] New: Don't warn for LOGICAL kind conversion with -Wconversion jb at gcc dot gnu.org
  2020-07-26  8:38 ` [Bug fortran/96319] " tkoenig at gcc dot gnu.org
@ 2020-07-28 17:11 ` dominiq at lps dot ens.fr
  2020-07-29 11:55 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-28 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Priority|P3                          |P5

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

* [Bug fortran/96319] Don't warn for LOGICAL kind conversion with -Wconversion
  2020-07-25 19:24 [Bug fortran/96319] New: Don't warn for LOGICAL kind conversion with -Wconversion jb at gcc dot gnu.org
  2020-07-26  8:38 ` [Bug fortran/96319] " tkoenig at gcc dot gnu.org
  2020-07-28 17:11 ` dominiq at lps dot ens.fr
@ 2020-07-29 11:55 ` cvs-commit at gcc dot gnu.org
  2020-07-29 14:18 ` cvs-commit at gcc dot gnu.org
  2020-07-29 14:20 ` markeggleston at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-29 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Mark Eggleston
<markeggleston@gcc.gnu.org>:

https://gcc.gnu.org/g:6af8284719d151087a1c1e4da210cc5a9fa4a478

commit r11-2403-g6af8284719d151087a1c1e4da210cc5a9fa4a478
Author: Mark Eggleston <markeggleston@gcc.gnu.org>
Date:   Mon Jul 27 15:28:50 2020 +0100

    Fortran  : Don't warn for LOGICAL kind conversion PR96319

    LOGICAL values will always fit regardless of kind so there
    is no need for warnings.

    2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

    gcc/fortran/

            PR fortran/96319
            * intrinsic.c (gfc_convert_type_warn):  Add check for
            LOGICAL type so that warnings are not output.

    2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

    gcc/testsuite/

            PR fortran/96319
            * gfortran.dg/pr96319.f90: New test.

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

* [Bug fortran/96319] Don't warn for LOGICAL kind conversion with -Wconversion
  2020-07-25 19:24 [Bug fortran/96319] New: Don't warn for LOGICAL kind conversion with -Wconversion jb at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-07-29 11:55 ` cvs-commit at gcc dot gnu.org
@ 2020-07-29 14:18 ` cvs-commit at gcc dot gnu.org
  2020-07-29 14:20 ` markeggleston at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-29 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Mark Eggleston
<markeggleston@gcc.gnu.org>:

https://gcc.gnu.org/g:3c4d2b867666464fad2dc5732940beaae48d8628

commit r10-8549-g3c4d2b867666464fad2dc5732940beaae48d8628
Author: Mark Eggleston <markeggleston@gcc.gnu.org>
Date:   Mon Jul 27 15:28:50 2020 +0100

    Fortran  : Don't warn for LOGICAL kind conversion PR96319

    LOGICAL values will always fit regardless of kind so there
    is no need for warnings.

    2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

    gcc/fortran/

            PR fortran/96319
            * intrinsic.c (gfc_convert_type_warn):  Add check for
            LOGICAL type so that warnings are not output.

    2020-07-29  Mark Eggleston  <markeggleston@gcc.gnu.org>

    gcc/testsuite/

            PR fortran/96319
            * gfortran.dg/pr96319.f90: New test.

    (cherry picked from commit 6af8284719d151087a1c1e4da210cc5a9fa4a478)

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

* [Bug fortran/96319] Don't warn for LOGICAL kind conversion with -Wconversion
  2020-07-25 19:24 [Bug fortran/96319] New: Don't warn for LOGICAL kind conversion with -Wconversion jb at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-07-29 14:18 ` cvs-commit at gcc dot gnu.org
@ 2020-07-29 14:20 ` markeggleston at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: markeggleston at gcc dot gnu.org @ 2020-07-29 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

markeggleston at gcc dot gnu.org changed:

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

--- Comment #4 from markeggleston at gcc dot gnu.org ---
Committed to master. The problem also occurs with gcc-10 but not gcc-9 or 8 so
it has been backported to gcc-10.

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

end of thread, other threads:[~2020-07-29 14:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25 19:24 [Bug fortran/96319] New: Don't warn for LOGICAL kind conversion with -Wconversion jb at gcc dot gnu.org
2020-07-26  8:38 ` [Bug fortran/96319] " tkoenig at gcc dot gnu.org
2020-07-28 17:11 ` dominiq at lps dot ens.fr
2020-07-29 11:55 ` cvs-commit at gcc dot gnu.org
2020-07-29 14:18 ` cvs-commit at gcc dot gnu.org
2020-07-29 14:20 ` markeggleston 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).