public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54818] New: error: type mismatch in binary expression
@ 2012-10-05  0:15 scott+gcc+bugzilla at pakin dot org
  2012-10-05  8:55 ` [Bug fortran/54818] [4.7/4.8 Regression] " dominiq at lps dot ens.fr
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: scott+gcc+bugzilla at pakin dot org @ 2012-10-05  0:15 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54818
           Summary: error: type mismatch in binary expression
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: scott+gcc+bugzilla@pakin.org


Created attachment 28360
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28360
Sample file that gfortran can't compile

PGI can compile the attached file:

    $ pgf90 --version

    pgf90 12.5-0 64-bit target on x86-64 Linux -tp istanbul 
    Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
    Copyright 2000-2012, STMicroelectronics, Inc.  All Rights Reserved.
    $ pgf90 -c broken.f

GCC cannot:

    $ gfortran --version
    GNU Fortran (GCC) 4.7.1
    Copyright (C) 2012 Free Software Foundation, Inc.

    GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
    You may redistribute copies of GNU Fortran
    under the terms of the GNU General Public License.
    For more information about these matters, see the file named COPYING
    $ gfortran -c broken.f
    broken.f: In function ‘broken’:
    broken.f:1:0: error: type mismatch in binary expression
    integer(kind=8)

    integer(kind=8)

    integer(kind=4)

    D.1918 = D.1867 + 8;

    broken.f:1:0: error: type mismatch in binary expression
    integer(kind=8)

    integer(kind=8)

    integer(kind=4)

    D.1922 = D.1867 + 8;

    broken.f:1: confused by earlier errors, bailing out


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
@ 2012-10-05  8:55 ` dominiq at lps dot ens.fr
  2012-10-05  9:10 ` janus at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-10-05  8:55 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-10-05
            Summary|error: type mismatch in     |[4.7/4.8 Regression] error:
                   |binary expression           |type mismatch in binary
                   |                            |expression
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-10-05 08:55:25 UTC ---
The test compiles with 4.6.3, but not with 4.4.6, 4.5.3, 4.7.2, and trunk.
Revision 171100 (2011-03-17) is OK, revision 171653 (2011-03-29) is not.


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
  2012-10-05  8:55 ` [Bug fortran/54818] [4.7/4.8 Regression] " dominiq at lps dot ens.fr
@ 2012-10-05  9:10 ` janus at gcc dot gnu.org
  2012-10-05 10:02 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2012-10-05  9:10 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from janus at gcc dot gnu.org 2012-10-05 09:09:39 UTC ---
Reduced test case:

implicit none
real :: name = 5.
print *, transfer(name,"a")//"xyz"
end


Fails here with 4.7 and trunk, but works with 4.3. Haven't tried other
versions.


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
  2012-10-05  8:55 ` [Bug fortran/54818] [4.7/4.8 Regression] " dominiq at lps dot ens.fr
  2012-10-05  9:10 ` janus at gcc dot gnu.org
@ 2012-10-05 10:02 ` rguenth at gcc dot gnu.org
  2012-10-05 10:21 ` dominiq at lps dot ens.fr
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-05 10:02 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.6.3
   Target Milestone|---                         |4.7.3


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (2 preceding siblings ...)
  2012-10-05 10:02 ` rguenth at gcc dot gnu.org
@ 2012-10-05 10:21 ` dominiq at lps dot ens.fr
  2012-10-21 14:50 ` tkoenig at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-10-05 10:21 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-10-05 10:20:49 UTC ---
AFAICT the problem occurs in 64 bit mode, but not in 32 one.


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (3 preceding siblings ...)
  2012-10-05 10:21 ` dominiq at lps dot ens.fr
@ 2012-10-21 14:50 ` tkoenig at gcc dot gnu.org
  2012-11-13 15:39 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-10-21 14:50 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-10-21 14:49:55 UTC ---
TRANSFER returns its length as a gfc_array_index_type (8 bytes
for 64 bits) and the concatenation operator as a standard string
length, 4 bytes.


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (4 preceding siblings ...)
  2012-10-21 14:50 ` tkoenig at gcc dot gnu.org
@ 2012-11-13 15:39 ` jakub at gcc dot gnu.org
  2012-12-17 20:57 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-13 15:39 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |jakub at gcc dot gnu.org


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (5 preceding siblings ...)
  2012-11-13 15:39 ` jakub at gcc dot gnu.org
@ 2012-12-17 20:57 ` burnus at gcc dot gnu.org
  2012-12-19  9:04 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-17 20:57 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-17 20:57:19 UTC ---
Untested patch:

--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2207 +2207,3 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr)
-                            lse.string_length, rse.string_length);
+                            lse.string_length,
+                            fold_convert (TREE_TYPE (lse.string_length),
+                                          rse.string_length));
@@ -2234,0 +2237 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr)
+


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (6 preceding siblings ...)
  2012-12-17 20:57 ` burnus at gcc dot gnu.org
@ 2012-12-19  9:04 ` burnus at gcc dot gnu.org
  2012-12-20  8:13 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-19  9:04 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-19 09:03:46 UTC ---
My patch is wrong. It might lead to passing an integer(8) instead of integer(4)
as hidden argument when calling a procedure. The proper way it to use
gfc_charlen_type_node.

However, the following works:

--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -5664,3 +5664,3 @@ scalar_transfer:
       se->expr = tmpdecl;
-      se->string_length = dest_word_len;
+      se->string_length = fold_convert (gfc_charlen_type_node, dest_word_len);
     }


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (7 preceding siblings ...)
  2012-12-19  9:04 ` burnus at gcc dot gnu.org
@ 2012-12-20  8:13 ` burnus at gcc dot gnu.org
  2012-12-20 10:48 ` burnus at gcc dot gnu.org
  2012-12-20 10:51 ` burnus at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-20  8:13 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-20 08:13:29 UTC ---
Author: burnus
Date: Thu Dec 20 08:13:21 2012
New Revision: 194628

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194628
Log:
2012-12-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54818
        * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ensure that
        the string length is of type gfc_charlen_type_node.

2012-12-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54818
        * gfortran.dg/transfer_intrinsic_4.f: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/transfer_intrinsic_4.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (8 preceding siblings ...)
  2012-12-20  8:13 ` burnus at gcc dot gnu.org
@ 2012-12-20 10:48 ` burnus at gcc dot gnu.org
  2012-12-20 10:51 ` burnus at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-20 10:48 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-20 10:48:15 UTC ---
Author: burnus
Date: Thu Dec 20 10:48:11 2012
New Revision: 194632

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194632
Log:
2012-12-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54818
        * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ensure that
        the string length is of type gfc_charlen_type_node.

2012-12-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54818
        * gfortran.dg/transfer_intrinsic_4.f: New.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/transfer_intrinsic_4.f
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/54818] [4.7/4.8 Regression] error: type mismatch in binary expression
  2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
                   ` (9 preceding siblings ...)
  2012-12-20 10:48 ` burnus at gcc dot gnu.org
@ 2012-12-20 10:51 ` burnus at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-20 10:51 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-20 10:50:47 UTC ---
FIXED on the 4.8 trunk and the 4.7 branch.

(4.6 does not seem to be affected and 4.5/4.6 aren't maintained anymore.)

Thanks for the bug report!


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

end of thread, other threads:[~2012-12-20 10:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05  0:15 [Bug fortran/54818] New: error: type mismatch in binary expression scott+gcc+bugzilla at pakin dot org
2012-10-05  8:55 ` [Bug fortran/54818] [4.7/4.8 Regression] " dominiq at lps dot ens.fr
2012-10-05  9:10 ` janus at gcc dot gnu.org
2012-10-05 10:02 ` rguenth at gcc dot gnu.org
2012-10-05 10:21 ` dominiq at lps dot ens.fr
2012-10-21 14:50 ` tkoenig at gcc dot gnu.org
2012-11-13 15:39 ` jakub at gcc dot gnu.org
2012-12-17 20:57 ` burnus at gcc dot gnu.org
2012-12-19  9:04 ` burnus at gcc dot gnu.org
2012-12-20  8:13 ` burnus at gcc dot gnu.org
2012-12-20 10:48 ` burnus at gcc dot gnu.org
2012-12-20 10:51 ` burnus 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).