public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33626]  New: Parentheses get wrong kind during matching
@ 2007-10-02 13:39 fxcoudert at gcc dot gnu dot org
  2007-10-02 15:59 ` [Bug fortran/33626] " fxcoudert at gcc dot gnu dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-02 13:39 UTC (permalink / raw)
  To: gcc-bugs

Matching of parentheses sometimes can end up giving wrong kind values to
expressions. In the following example, output should only be ones, as all
expressions have kind=1. What has me worried in particular is the difference
between the last two cases.


$ cat a.f90
  logical(kind=1) :: i, j
  integer(kind=1) :: a, b
  print *, kind(i .and. j)
  print *, kind(.not. (i .and. j))
  print *, kind((a + b))
  print *, kind((42_1))

  print *, kind((j .and. i))
  print *, kind((.true._1))
  end
$ gfortran a.f90 && ./a.out
           1
           4
           1
           1
           4
           1


This bug is the reason why intrinsic_associated_2.f90 fails with type checking
enabled, and also fails with -fdefault-integer-8. This
intrinsic_associated_2.f90 failure can (and should, in my opinion) also be
fixed by the following patch.


Index: trans-expr.c
===================================================================
--- trans-expr.c        (revision 128951)
+++ trans-expr.c        (working copy)
@@ -592,7 +592,7 @@ gfc_conv_unary_op (enum tree_code code,
      All other unary operators have an equivalent GIMPLE unary operator.  */
   if (code == TRUTH_NOT_EXPR)
     se->expr = build2 (EQ_EXPR, type, operand.expr,
-                      build_int_cst (type, 0));
+                      build_int_cst (TREE_TYPE (operand.expr), 0));
   else
     se->expr = build1 (code, type, operand.expr);


-- 
           Summary: Parentheses get wrong kind during matching
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


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


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

end of thread, other threads:[~2007-10-04 15:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-02 13:39 [Bug fortran/33626] New: Parentheses get wrong kind during matching fxcoudert at gcc dot gnu dot org
2007-10-02 15:59 ` [Bug fortran/33626] " fxcoudert at gcc dot gnu dot org
2007-10-03 14:40 ` tobi at gcc dot gnu dot org
2007-10-03 16:12 ` tobi at gcc dot gnu dot org
2007-10-03 16:22 ` tobi at gcc dot gnu dot org
2007-10-03 16:26 ` fxcoudert at gcc dot gnu dot org
2007-10-03 16:36 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-03 16:40 ` fxcoudert at gcc dot gnu dot org
2007-10-03 16:46 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-03 16:52 ` fxcoudert at gcc dot gnu dot org
2007-10-03 17:06 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-03 17:09 ` fxcoudert at gcc dot gnu dot org
2007-10-03 22:06 ` fxcoudert at gcc dot gnu dot org
2007-10-04  7:35 ` tobi at gcc dot gnu dot org
2007-10-04 15:11 ` fxcoudert at gcc dot gnu dot org
2007-10-04 15:24 ` tobi at gcc dot gnu dot 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).