public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37400]  New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
@ 2008-09-06 19:01 dominiq at lps dot ens dot fr
  2008-09-06 23:08 ` [Bug fortran/37400] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-09-06 19:01 UTC (permalink / raw)
  To: gcc-bugs

Extracted form
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/c553e0034bab977c
(see pr34199) the following code:

module mod 
   implicit character(len=*,kind=kind('A')) (Q) 
   parameter(Q1 = 'Test Me!') 
   parameter(Q2 = 'Test Me Too!') 
   contains 
      subroutine sub(Q3) 
         write(*,*) '#'//Q3//'#' 
      end subroutine sub 
end module mod 
program startest 
   use mod 
   implicit none 
   write(*,*) '#'//Q1//'#' 
   write(*,*) '#'//Q2//'#' 
   call sub('Test Me More!') 
end program startest 

when compiled with gfortran 4.3.2, gives the expected (by me) output:

 #Test Me!#
 #Test Me Too!#
 #Test Me More!#

while when compiled with gfortran 4.4.0, it gives:

 #Test Me!#
 #Test Me #
 #Test Me #


-- 
           Summary: [4.4 Regression] implicit
                    character(len=*,kind=kind('A')) (Q) ... no longer gives
                    the right answer.
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr


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


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

* [Bug fortran/37400] [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
  2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
@ 2008-09-06 23:08 ` pinskia at gcc dot gnu dot org
  2008-09-07  7:51 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-06 23:08 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Target Milestone|---                         |4.4.0


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


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

* [Bug fortran/37400] [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
  2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
  2008-09-06 23:08 ` [Bug fortran/37400] " pinskia at gcc dot gnu dot org
@ 2008-09-07  7:51 ` burnus at gcc dot gnu dot org
  2008-09-07  8:36 ` domob at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-07  7:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-09-07 07:50 -------
The problem is that for
   implicit character(len=*,kind=kind('A')) (Q)
the length of the first parameter string is used everywhere. The following
fixes it, but I have no idea why it is a regression / why it worked before.

(I'm almost positive that we will forget to do something similar for deferred
derived-type len parameter of F2003.)


Index: symbol.c
===================================================================
--- symbol.c    (Revision 140081)
+++ symbol.c    (Arbeitskopie)
@@ -257,6 +257,12 @@ gfc_set_default_type (gfc_symbol *sym, i
   sym->ts = *ts;
   sym->attr.implicit_type = 1;

+  if (ts->cl)
+    {
+      sym->ts.cl = gfc_get_charlen ();
+      *sym->ts.cl = *ts->cl;
+    }
+
   if (sym->attr.is_bind_c == 1)
     {
       /* BIND(C) variables should not be implicitly declared.  */


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-09-07 07:50:29
               date|                            |


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


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

* [Bug fortran/37400] [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
  2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
  2008-09-06 23:08 ` [Bug fortran/37400] " pinskia at gcc dot gnu dot org
  2008-09-07  7:51 ` burnus at gcc dot gnu dot org
@ 2008-09-07  8:36 ` domob at gcc dot gnu dot org
  2008-09-07  9:14 ` dominiq at lps dot ens dot fr
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-09-07  8:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from domob at gcc dot gnu dot org  2008-09-07 08:34 -------
(In reply to comment #1)
> The problem is that for
>    implicit character(len=*,kind=kind('A')) (Q)
> the length of the first parameter string is used everywhere. The following
> fixes it, but I have no idea why it is a regression / why it worked before.

Could this have something to do with my used-before-typed patch that might have
changed a little when/why symbols get their IMPLICIT type?  Other than that, I
can't imagine anything, either.

But your patch looks good, just intuitively...


-- 


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


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

* [Bug fortran/37400] [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
  2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
                   ` (2 preceding siblings ...)
  2008-09-07  8:36 ` domob at gcc dot gnu dot org
@ 2008-09-07  9:14 ` dominiq at lps dot ens dot fr
  2008-09-07 21:11 ` dominiq at lps dot ens dot fr
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-09-07  9:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dominiq at lps dot ens dot fr  2008-09-07 09:13 -------
Subject: Re:  [4.4 Regression] implicit
 character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.

> But your patch looks good, just intuitively...

The patch works as expected, at least on my quick tests. I'll do a full
regtesting this afternoon.

Thanks for the quick fix.

Dominique


-- 


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


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

* [Bug fortran/37400] [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
  2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
                   ` (3 preceding siblings ...)
  2008-09-07  9:14 ` dominiq at lps dot ens dot fr
@ 2008-09-07 21:11 ` dominiq at lps dot ens dot fr
  2008-09-08  7:22 ` burnus at gcc dot gnu dot org
  2008-09-08  7:40 ` burnus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-09-07 21:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dominiq at lps dot ens dot fr  2008-09-07 21:10 -------
Regtests passed without regressions on i686-apple-darwin9. Thanks again for the
patch.


-- 


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


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

* [Bug fortran/37400] [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
  2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
                   ` (4 preceding siblings ...)
  2008-09-07 21:11 ` dominiq at lps dot ens dot fr
@ 2008-09-08  7:22 ` burnus at gcc dot gnu dot org
  2008-09-08  7:40 ` burnus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-08  7:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2008-09-08 07:21 -------
Subject: Bug 37400

Author: burnus
Date: Mon Sep  8 07:19:46 2008
New Revision: 140100

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140100
Log:
2008-09-07  Tobias Burnus  <burnus@net.b.de>

        PR fortran/37400
        * symbol.c (gfc_set_default_type): Copy char len.

2008-09-07  Tobias Burnus  <burnus@net.b.de>

        PR fortran/37400
        * gfortran.dg/implicit_12.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/implicit_12.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/37400] [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer.
  2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
                   ` (5 preceding siblings ...)
  2008-09-08  7:22 ` burnus at gcc dot gnu dot org
@ 2008-09-08  7:40 ` burnus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-08  7:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2008-09-08 07:38 -------
FIXED on the trunk (4.4.0).

(I'm not sure whether it fully works with 4.3.x - I get a segmentation fault
after the third line is correctly printed. The cause that it was failing on 4.4
was the patch for PR 36476; but it was not the underlying reason for the bug.)


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-09-08  7:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-06 19:01 [Bug fortran/37400] New: [4.4 Regression] implicit character(len=*,kind=kind('A')) (Q) ... no longer gives the right answer dominiq at lps dot ens dot fr
2008-09-06 23:08 ` [Bug fortran/37400] " pinskia at gcc dot gnu dot org
2008-09-07  7:51 ` burnus at gcc dot gnu dot org
2008-09-07  8:36 ` domob at gcc dot gnu dot org
2008-09-07  9:14 ` dominiq at lps dot ens dot fr
2008-09-07 21:11 ` dominiq at lps dot ens dot fr
2008-09-08  7:22 ` burnus at gcc dot gnu dot org
2008-09-08  7:40 ` burnus 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).