public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35937]  New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8
@ 2008-04-14 19:18 tkoenig at gcc dot gnu dot org
  2008-04-14 19:39 ` [Bug fortran/35937] " dominiq at lps dot ens dot fr
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-04-14 19:18 UTC (permalink / raw)
  To: gcc-bugs

$ gfortran -g -fdefault-integer-8 char_result_5.f90 
$ gdb ./a.out
GNU gdb 6.7.1-debian
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1".
(gdb) r
Starting program: /tmp/a.out 

Program received signal SIGSEGV, Segmentation fault.
0xb7f82664 in *_gfortran_string_scan (slen=9, str=0x804b480 "123456789",
setlen=1, set=0x0, back=-1080910905)
    at ../../../../gcc/trunk/libgfortran/intrinsics/string_intrinsics.c:300
300                   if (str[i] == set[j])


-- 
           Summary: char_result_5.f90 / char_result_6.f90 fail with -
                    fdefault-integer-8
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
 BugsThisDependsOn: 32770


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


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

* [Bug fortran/35937] char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
@ 2008-04-14 19:39 ` dominiq at lps dot ens dot fr
  2008-04-14 19:46 ` tkoenig at gcc dot gnu dot org
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-04-14 19:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2008-04-14 19:39 -------
See the attached file in comment #7 of PR32770.


-- 


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


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

* [Bug fortran/35937] char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
  2008-04-14 19:39 ` [Bug fortran/35937] " dominiq at lps dot ens dot fr
@ 2008-04-14 19:46 ` tkoenig at gcc dot gnu dot org
  2008-04-14 20:27 ` dominiq at lps dot ens dot fr
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-04-14 19:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at gcc dot gnu dot org  2008-04-14 19:45 -------
The right way around...

> See the attached file in comment #7 of PR32770.

Yes, I'm trying to make indiviual PRs of all failures that
I see.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|32770                       |
OtherBugsDependingO|                            |32770
              nThis|                            |


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


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

* [Bug fortran/35937] char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
  2008-04-14 19:39 ` [Bug fortran/35937] " dominiq at lps dot ens dot fr
  2008-04-14 19:46 ` tkoenig at gcc dot gnu dot org
@ 2008-04-14 20:27 ` dominiq at lps dot ens dot fr
  2008-05-12 17:44 ` [Bug fortran/35937] Wrong type for charlength of function fxcoudert at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-04-14 20:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dominiq at lps dot ens dot fr  2008-04-14 20:27 -------
On i686-apple-darwin9, the tests pass with -m64, but fail with -m32. 
The errors are due to all the tests with f5.


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-04-14 20:27 ` dominiq at lps dot ens dot fr
@ 2008-05-12 17:44 ` fxcoudert at gcc dot gnu dot org
  2008-05-12 17:45 ` fxcoudert at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-12 17:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2008-05-12 17:44 -------
It's not an issue limited to SCAN, it can happen to all functions (intrinsics
or not). Reduced testcase, showing the failure even without
-fdefault-integer-8:

program main
  implicit none

  print *, len(f5('1'))
contains

  function f5 (c)
    character(len=1_8) :: c
    character(len=scan('123456789', c)) :: f5
  end function f5

end program main


The problem is subtle: when the length of f5 is evaluated, it's done outside of
the body of f5 itself. And there, the string length variable is somehow set to
a integer(kind=8), as is specified by its original type. This is a failure in
the complicated mapping mechanism, and a nightmare to track, because we start
with the right type but something somewhere changes it under our feet. After a
long chase, I found it's gfc_finish_interface_mapping() that is not doing its
job properly, and the following patch fixes it:

Index: trans-expr.c
===================================================================
--- trans-expr.c        (revision 135088)
+++ trans-expr.c        (working copy)
@@ -1671,7 +1671,19 @@ gfc_finish_interface_mapping (gfc_interf
        gfc_init_se (&se, NULL);
        gfc_conv_expr (&se, expr);

-       se.expr = gfc_evaluate_now (se.expr, &se.pre);
+       /* Give the string length the right type.  If we deal with a
+          simple constant, which is the most common case, we don't need
+          to create a temporary variable.  */
+       if (CONSTANT_CLASS_P (se.expr))
+         se.expr = fold_convert (gfc_charlen_type_node, se.expr);
+       else
+         {
+           tree tmp = gfc_create_var (gfc_charlen_type_node, "slength");
+           gfc_add_modify_expr (&se.pre, tmp,
+                                fold_convert (gfc_charlen_type_node,
se.expr));
+           se.expr = tmp;
+         }
+
        gfc_add_block_to_block (pre, &se.pre);
        gfc_add_block_to_block (post, &se.post);


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |patch
   Last reconfirmed|0000-00-00 00:00:00         |2008-05-12 17:44:16
               date|                            |
            Summary|char_result_5.f90 /         |Wrong type for charlength of
                   |char_result_6.f90 fail with |function
                   |-fdefault-integer-8         |


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-05-12 17:44 ` [Bug fortran/35937] Wrong type for charlength of function fxcoudert at gcc dot gnu dot org
@ 2008-05-12 17:45 ` fxcoudert at gcc dot gnu dot org
  2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-12 17:45 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-05-12 17:44:16         |2008-05-12 17:44:23
               date|                            |


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-05-12 17:45 ` fxcoudert at gcc dot gnu dot org
@ 2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
  2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-12 18:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-05-12 17:44:23         |2008-05-12 18:26:50
               date|                            |


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
@ 2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
  2008-07-23 16:29 ` pault at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-12 18:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |05/msg00700.html
             Status|ASSIGNED                    |NEW


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
@ 2008-07-23 16:29 ` pault at gcc dot gnu dot org
  2008-08-08 21:39 ` jv244 at cam dot ac dot uk
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-07-23 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2008-07-23 16:28 -------
(In reply to comment #4)
Hi FX

Your patch looks fine to me.  In particular, you have tackled it at the right
place.  However, I have a question: why is this not sufficient?

se.expr = gfc_evaluate_now (fold_convert (gfc_charlen_type_node), &se.pre);

Cheers

Paul


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-07-23 16:29 ` pault at gcc dot gnu dot org
@ 2008-08-08 21:39 ` jv244 at cam dot ac dot uk
  2008-08-08 21:51 ` dominiq at lps dot ens dot fr
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-08-08 21:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jv244 at cam dot ac dot uk  2008-08-08 21:38 -------
the testcase in comment #4 is working now. Is the bug still open?


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-08-08 21:39 ` jv244 at cam dot ac dot uk
@ 2008-08-08 21:51 ` dominiq at lps dot ens dot fr
  2008-08-23  8:15 ` fxcoudert at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-08-08 21:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dominiq at lps dot ens dot fr  2008-08-08 21:50 -------
On i686-apple-darwin9, the testcase in comment #4 gives a "Bus error" at -m32
(rev. 138886).


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-08-08 21:51 ` dominiq at lps dot ens dot fr
@ 2008-08-23  8:15 ` fxcoudert at gcc dot gnu dot org
  2008-11-28 14:33 ` pault at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-08-23  8:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2008-11-28 14:33 ` pault at gcc dot gnu dot org
@ 2008-11-28 14:33 ` pault at gcc dot gnu dot org
  2008-11-30 13:15 ` pault at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-11-28 14:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2008-11-28 14:31 -------
(In reply to comment #7)
> On i686-apple-darwin9, the testcase in comment #4 gives a "Bus error" at -m32
> (rev. 138886).
> 
I'm going to look at this one over this weekend - the bus error with -m32 is
wierd:-)  Anyhow, it should be easy to sort out.

Cheers

Paul


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2008-08-23  8:15 ` fxcoudert at gcc dot gnu dot org
@ 2008-11-28 14:33 ` pault at gcc dot gnu dot org
  2008-11-28 14:33 ` pault at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-11-28 14:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2008-11-28 14:32 -------
I might as well take it too:-)

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-05-12 18:26:50         |2008-11-28 14:32:29
               date|                            |


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2008-11-28 14:33 ` pault at gcc dot gnu dot org
@ 2008-11-30 13:15 ` pault at gcc dot gnu dot org
  2008-12-02 20:05 ` dominiq at lps dot ens dot fr
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-11-30 13:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2008-11-30 13:13 -------
(In reply to comment #9)
> I might as well take it too:-)

Since I cannot reproduce the bug, even at -m32, I am unassigning myself.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pault at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2008-11-30 13:15 ` pault at gcc dot gnu dot org
@ 2008-12-02 20:05 ` dominiq at lps dot ens dot fr
  2008-12-03  5:53 ` pault at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-12-02 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from dominiq at lps dot ens dot fr  2008-12-02 20:03 -------
On powerpc-apple-darwin9, the test in comment #4 returns 0 with -m32 (no bus
error) instead of 1 with -m64.

I have applied the proposed patches in comment #4 and #5 (one at a time!-), but
they don't fix the wrong code (note also that gfortran with patch #4 pass the
test suite without regression).

> Since I cannot reproduce the bug, even at -m32, I am unassigning myself.

Did you get the expected result also?


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2008-12-02 20:05 ` dominiq at lps dot ens dot fr
@ 2008-12-03  5:53 ` pault at gcc dot gnu dot org
  2008-12-10 15:18 ` dominiq at lps dot ens dot fr
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-12-03  5:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pault at gcc dot gnu dot org  2008-12-03 05:52 -------
(In reply to comment #11)

> Did you get the expected result also?
> 

I couldn't tell - I did not have the 32 bit library installed.  I'll try to fix
that.

Cheers

Paul


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (15 preceding siblings ...)
  2008-12-03  5:53 ` pault at gcc dot gnu dot org
@ 2008-12-10 15:18 ` dominiq at lps dot ens dot fr
  2008-12-10 16:19 ` dominiq at lps dot ens dot fr
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-12-10 15:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from dominiq at lps dot ens dot fr  2008-12-10 15:17 -------
In comment #11, I wrote:
> I have applied the proposed patches in comment #4 and #5 (one at a time!-), but
> they don't fix the wrong code (note also that gfortran with patch #4 pass the
> test suite without regression).

Sorry, but I have applied the patches to the wrong tree (my reference one and
not the working one).

The patch in comment #4 needs to be updated by replacing 'gfc_add_modify_expr'
with 'gfc_add_modify', see "2008-07-28 ...   Merge from gimple-tuples-branch."
in gcc/fortran/ChangeLog.

The patch in comment #5 has a typo and should be:

se.expr = gfc_evaluate_now (fold_convert (gfc_charlen_type_node, se.expr),
&se.pre);

I have applied the first patch on powerpc-apple-darwin9 and the second on
i686-apple-darwin9. They both fix the problem and pass my tests. Regtesting
started.


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (16 preceding siblings ...)
  2008-12-10 15:18 ` dominiq at lps dot ens dot fr
@ 2008-12-10 16:19 ` dominiq at lps dot ens dot fr
  2008-12-10 19:17 ` dominiq at lps dot ens dot fr
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-12-10 16:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from dominiq at lps dot ens dot fr  2008-12-10 16:18 -------
> The patch in comment #5 has a typo and should be:
>
> se.expr = gfc_evaluate_now (fold_convert (gfc_charlen_type_node, se.expr),
> &se.pre);

This patch regtested without regression on i686-apple-darwin9. I'll try it
later on powerpc-apple-darwin9. Unless someone come with a test that requires
the patch in comment #4 (failing with the above change), I'll think the one
line change will be better.


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (17 preceding siblings ...)
  2008-12-10 16:19 ` dominiq at lps dot ens dot fr
@ 2008-12-10 19:17 ` dominiq at lps dot ens dot fr
  2008-12-11  9:39 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-12-10 19:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from dominiq at lps dot ens dot fr  2008-12-10 19:15 -------
No regression also on powerpc-apple-darwin9 (patch in comment#4).

If I understand the two proposed patches, the only difference is that the FX's
one create a temporary if CONSTANT_CLASS_P (se.expr) is not true. Is this
really necessary? For what "se.expr" will CONSTANT_CLASS_P return false?


-- 

dominiq at lps dot ens dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (18 preceding siblings ...)
  2008-12-10 19:17 ` dominiq at lps dot ens dot fr
@ 2008-12-11  9:39 ` pault at gcc dot gnu dot org
  2008-12-11 10:02 ` dominiq at lps dot ens dot fr
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-12-11  9:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from pault at gcc dot gnu dot org  2008-12-11 09:38 -------
Hah! My VMware Fedora catches the bug and demonstrates that my simple fix of
comment #5 does the job; ie. unconditionally do the constant fold to a
gfc_charlen_type_node.  This can never do any harm!

I will fix it as soon as I can - likely Sunday or Monday night.

Cheers

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-11-28 14:32:29         |2008-12-11 09:38:22
               date|                            |


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (19 preceding siblings ...)
  2008-12-11  9:39 ` pault at gcc dot gnu dot org
@ 2008-12-11 10:02 ` dominiq at lps dot ens dot fr
  2008-12-11 10:40 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-12-11 10:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from dominiq at lps dot ens dot fr  2008-12-11 10:00 -------
> Hah! My VMware Fedora catches the bug and demonstrates that my simple fix of
> comment #5 does the job; ie. unconditionally do the constant fold to a
> gfc_charlen_type_node.  This can never do any harm!

I have looked a litte bit closer to the patch in comment #4. AFAICT it
implements what gfc_evaluate_now does with the difference that

  var = gfc_create_var (TREE_TYPE (expr), NULL);

is replaced with

 +           tree tmp = gfc_create_var (gfc_charlen_type_node, "slength");

Has "slength" any chance to make a difference compared to NULL?


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (20 preceding siblings ...)
  2008-12-11 10:02 ` dominiq at lps dot ens dot fr
@ 2008-12-11 10:40 ` fxcoudert at gcc dot gnu dot org
  2008-12-14 16:03 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-12-11 10:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from fxcoudert at gcc dot gnu dot org  2008-12-11 10:39 -------
(In reply to comment #17)
>   var = gfc_create_var (TREE_TYPE (expr), NULL);
> 
> is replaced with
> 
>  +           tree tmp = gfc_create_var (gfc_charlen_type_node, "slength");
> 
> Has "slength" any chance to make a difference compared to NULL?

You're just giving an explicit name to the variable instead of having it called
D.number, it shouldn't make any difference.


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (21 preceding siblings ...)
  2008-12-11 10:40 ` fxcoudert at gcc dot gnu dot org
@ 2008-12-14 16:03 ` pault at gcc dot gnu dot org
  2008-12-14 16:10 ` pault at gcc dot gnu dot org
  2008-12-14 16:13 ` pault at gcc dot gnu dot org
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-12-14 16:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from pault at gcc dot gnu dot org  2008-12-14 16:01 -------
Subject: Bug 35937

Author: pault
Date: Sun Dec 14 16:00:25 2008
New Revision: 142750

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142750
Log:
2008-12-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35937
        * trans-expr.c (gfc_finish_interface_mapping): Fold convert the
        character length to gfc_charlen_type_node.

2008-12-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35937
        * gfortran.dg/char_length_14.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/char_length_14.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (22 preceding siblings ...)
  2008-12-14 16:03 ` pault at gcc dot gnu dot org
@ 2008-12-14 16:10 ` pault at gcc dot gnu dot org
  2008-12-14 16:13 ` pault at gcc dot gnu dot org
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-12-14 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from pault at gcc dot gnu dot org  2008-12-14 16:09 -------
Subject: Bug 35937

Author: pault
Date: Sun Dec 14 16:07:46 2008
New Revision: 142751

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142751
Log:
2008-12-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35937
        * trans-expr.c (gfc_finish_interface_mapping): Fold convert the
        character length to gfc_charlen_type_node.

2008-12-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35937
        * gfortran.dg/char_length_14.f90: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/char_length_14.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/35937] Wrong type for charlength of function
  2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
                   ` (23 preceding siblings ...)
  2008-12-14 16:10 ` pault at gcc dot gnu dot org
@ 2008-12-14 16:13 ` pault at gcc dot gnu dot org
  24 siblings, 0 replies; 26+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-12-14 16:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from pault at gcc dot gnu dot org  2008-12-14 16:11 -------
Fixed on trunk and 4.3.

Thanks for the report.

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-12-14 16:13 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14 19:18 [Bug fortran/35937] New: char_result_5.f90 / char_result_6.f90 fail with -fdefault-integer-8 tkoenig at gcc dot gnu dot org
2008-04-14 19:39 ` [Bug fortran/35937] " dominiq at lps dot ens dot fr
2008-04-14 19:46 ` tkoenig at gcc dot gnu dot org
2008-04-14 20:27 ` dominiq at lps dot ens dot fr
2008-05-12 17:44 ` [Bug fortran/35937] Wrong type for charlength of function fxcoudert at gcc dot gnu dot org
2008-05-12 17:45 ` fxcoudert at gcc dot gnu dot org
2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
2008-05-12 18:27 ` fxcoudert at gcc dot gnu dot org
2008-07-23 16:29 ` pault at gcc dot gnu dot org
2008-08-08 21:39 ` jv244 at cam dot ac dot uk
2008-08-08 21:51 ` dominiq at lps dot ens dot fr
2008-08-23  8:15 ` fxcoudert at gcc dot gnu dot org
2008-11-28 14:33 ` pault at gcc dot gnu dot org
2008-11-28 14:33 ` pault at gcc dot gnu dot org
2008-11-30 13:15 ` pault at gcc dot gnu dot org
2008-12-02 20:05 ` dominiq at lps dot ens dot fr
2008-12-03  5:53 ` pault at gcc dot gnu dot org
2008-12-10 15:18 ` dominiq at lps dot ens dot fr
2008-12-10 16:19 ` dominiq at lps dot ens dot fr
2008-12-10 19:17 ` dominiq at lps dot ens dot fr
2008-12-11  9:39 ` pault at gcc dot gnu dot org
2008-12-11 10:02 ` dominiq at lps dot ens dot fr
2008-12-11 10:40 ` fxcoudert at gcc dot gnu dot org
2008-12-14 16:03 ` pault at gcc dot gnu dot org
2008-12-14 16:10 ` pault at gcc dot gnu dot org
2008-12-14 16:13 ` pault 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).