public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40629]  New: Host association problem
@ 2009-07-03  8:04 philippe dot marguinaud at meteo dot fr
  2009-07-03  8:18 ` [Bug fortran/40629] " dominiq at lps dot ens dot fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: philippe dot marguinaud at meteo dot fr @ 2009-07-03  8:04 UTC (permalink / raw)
  To: gcc-bugs

The following code (inspired from host_assoc_function_1.f90) breaks f951:

MODULE m
  REAL :: x
CONTAINS
  SUBROUTINE s
  CONTAINS
    SUBROUTINE inner
      y = x(1, 1)
    END SUBROUTINE
    FUNCTION x(n, m)
    END FUNCTION
  END SUBROUTINE
END MODULE

I have an internal compiler error with f951; I have checked out and built the
latest version of fortran this morning. Note that host_assoc_function_1.f90
compiles OK.


-- 
           Summary: Host association problem
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: philippe dot marguinaud at meteo dot fr
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug fortran/40629] Host association problem
  2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
@ 2009-07-03  8:18 ` dominiq at lps dot ens dot fr
  2009-07-03 10:13 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-07-03  8:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2009-07-03 08:18 -------
Confirmed on i686-apple-darwin9. More precisely, I get:

pr40629.f90:12.10:

END MODULE
          1
Error: Symbol 'x' at (1) has already been host associated
f951: internal compiler error: Bus error


-- 


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


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

* [Bug fortran/40629] Host association problem
  2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
  2009-07-03  8:18 ` [Bug fortran/40629] " dominiq at lps dot ens dot fr
@ 2009-07-03 10:13 ` burnus at gcc dot gnu dot org
  2009-07-08 13:23 ` pault 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 @ 2009-07-03 10:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-07-03 10:13 -------
Confirmed. One first gets the error message from gfc_get_sym_tree (already been
host associated), followed by the segfault, which happens at
==12785== Use of uninitialised value of size 8
==12785==    at 0x500F17: gfc_resolve_expr (resolve.c:4459)
which is
  4457            /* Give the symbol a symtree in the right place!  */
  4458            gfc_get_sym_tree (sym->name, gfc_current_ns, &st, false);
  4459            st->n.sym = sym;

Thus one should add a check for "st == NULL" (e.g via gcc_assert) and fix
gfc_get_sym_tree.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|x86_64-unknown-linux-gnu    |
   GCC host triplet|x86_64-unknown-linux-gnu    |
 GCC target triplet|x86_64-unknown-linux-gnu    |
           Keywords|                            |rejects-valid
      Known to fail|                            |4.1.3 4.2.1 4.3.3 4.4.1
                   |                            |4.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-03 10:13:01
               date|                            |


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


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

* [Bug fortran/40629] Host association problem
  2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
  2009-07-03  8:18 ` [Bug fortran/40629] " dominiq at lps dot ens dot fr
  2009-07-03 10:13 ` burnus at gcc dot gnu dot org
@ 2009-07-08 13:23 ` pault at gcc dot gnu dot org
  2009-07-08 19:05 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-07-08 13:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2009-07-08 13:22 -------
Created an attachment (id=18157)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18157&action=view)
Fix for bug - not regtested yet

This handles host_assoc_function_*.f90 correctly but is not yet regtested.

The testcase will be something like:

! { dg-do run }
! Tests the fix for the bug PR40629, in which the reference to 'x'
! in 'upper' wrongly host-associated with the symbol 'x' at module
! leve rather than the function.
!
! Contributed by Philippe Marguinaud  <philippe.marguinaud@meteo.fr>
!
MODULE m
  REAL :: x = 0
CONTAINS
                                                                               
                                                                               
                                                                               
                                                                               
                                                                               
                                                                         
SUBROUTINE s
  call upper
  call lower
  CONTAINS
    SUBROUTINE upper
     y = x(3,1)
     if (int(y) .ne. 3) call abort
    END SUBROUTINE
    FUNCTION x(n, m)
       x = m*n
    END FUNCTION
    SUBROUTINE lower
     y = x(2,1)
     if (int(y) .ne. 3) call abort
    END SUBROUTINE
  END SUBROUTINE
END MODULE

  use m
  call s
end
! { dg-final { cleanup-modules "m" } }


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


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


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

* [Bug fortran/40629] Host association problem
  2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
                   ` (2 preceding siblings ...)
  2009-07-08 13:23 ` pault at gcc dot gnu dot org
@ 2009-07-08 19:05 ` pault at gcc dot gnu dot org
  2009-07-09 16:49 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-07-08 19:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2009-07-08 19:05 -------
(In reply to comment #3)
> Created an attachment (id=18157)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18157&action=view) [edit]
> Fix for bug - not regtested yet
> 
> This handles host_assoc_function_*.f90 correctly but is not yet regtested.
> 
> The testcase will be something like:
> 
> ! { dg-do run }
> ! Tests the fix for the bug PR40629, in which the reference to 'x'
> ! in 'upper' wrongly host-associated with the symbol 'x' at module
> ! leve rather than the function.
> !
> ! Contributed by Philippe Marguinaud  <philippe.marguinaud@meteo.fr>
> !
> MODULE m
>   REAL :: x = 0
> CONTAINS
>                                                                                
>                                                                                
>                                                                                
>                                                                                
>                                                                                
>                                                                          
> SUBROUTINE s
>   call upper
>   call lower
>   CONTAINS
>     SUBROUTINE upper
>      y = x(3,1)
>      if (int(y) .ne. 3) call abort
>     END SUBROUTINE
>     FUNCTION x(n, m)
>        x = m*n
>     END FUNCTION
>     SUBROUTINE lower
>      y = x(2,1)
>      if (int(y) .ne. 3) call abort
>     END SUBROUTINE
>   END SUBROUTINE
> END MODULE
> 
>   use m
>   call s
> end
> ! { dg-final { cleanup-modules "m" } }
> 
> 
> Paul
> 

The last abort should happen on a value of 2, of course.

Paul


-- 


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


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

* [Bug fortran/40629] Host association problem
  2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
                   ` (3 preceding siblings ...)
  2009-07-08 19:05 ` pault at gcc dot gnu dot org
@ 2009-07-09 16:49 ` pault at gcc dot gnu dot org
  2009-12-13 22:06 ` burnus at gcc dot gnu dot org
  2009-12-14  5:21 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-07-09 16:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2009-07-09 16:49 -------
Subject: Bug 40629

Author: pault
Date: Thu Jul  9 16:48:50 2009
New Revision: 149422

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

        PR fortran/40629
        * resolve.c (check_host_association):  Use the existing
        accessible symtree and treat function expressions with
        symbols that have procedure flavor.

2008-07-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/40629
        * gfortran.dg/host_assoc_function_9.f90: New test.



Added:
    trunk/gcc/testsuite/gfortran.dg/host_assoc_function_9.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/40629] Host association problem
  2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
                   ` (4 preceding siblings ...)
  2009-07-09 16:49 ` pault at gcc dot gnu dot org
@ 2009-12-13 22:06 ` burnus at gcc dot gnu dot org
  2009-12-14  5:21 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-12-13 22:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2009-12-13 22:05 -------
Paul what is the status of this PR? I see a commit as last comment. Is this
fixed? Is something missing?


-- 


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


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

* [Bug fortran/40629] Host association problem
  2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
                   ` (5 preceding siblings ...)
  2009-12-13 22:06 ` burnus at gcc dot gnu dot org
@ 2009-12-14  5:21 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-12-14  5:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2009-12-14 05:20 -------
(In reply to comment #6)
> Paul what is the status of this PR? I see a commit as last comment. Is this
> fixed? Is something missing?
> 

>From everything that I can see, it is fixed. Thanks for the reminder.

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=40629


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

end of thread, other threads:[~2009-12-14  5:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-03  8:04 [Bug fortran/40629] New: Host association problem philippe dot marguinaud at meteo dot fr
2009-07-03  8:18 ` [Bug fortran/40629] " dominiq at lps dot ens dot fr
2009-07-03 10:13 ` burnus at gcc dot gnu dot org
2009-07-08 13:23 ` pault at gcc dot gnu dot org
2009-07-08 19:05 ` pault at gcc dot gnu dot org
2009-07-09 16:49 ` pault at gcc dot gnu dot org
2009-12-13 22:06 ` burnus at gcc dot gnu dot org
2009-12-14  5:21 ` 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).