public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40949]  New: FAIL: gfortran.dg/proc_ptr_7.f90
@ 2009-08-03 13:55 rguenth at gcc dot gnu dot org
  2009-08-03 23:17 ` [Bug fortran/40949] " burnus at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-03 13:55 UTC (permalink / raw)
  To: gcc-bugs

The fortran frontend does not properly terminate function type argument lists
with void_type_node.

 integer(c_int) function f55()
    f55 = 55
 end function f55

 integer(c_int) function f65()
    f65 = 65
 end function f65

do not match the argument in

void assignf_(int(**ptr)(void)) {
  *ptr = f;
}

prototype-wise, but instead would match

void assignf_(int(**ptr)()) {
  *ptr = f;
}

which has an unprototyped argument list.

I see the Fortran FE accepts excess parameters to functions and only warns
for that with -fwhole-file ...


-- 
           Summary: FAIL: gfortran.dg/proc_ptr_7.f90
           Product: gcc
           Version: lto
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
@ 2009-08-03 23:17 ` burnus at gcc dot gnu dot org
  2009-08-04  8:14 ` rguenther at suse dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-03 23:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-08-03 23:17 -------
> I see the Fortran FE accepts excess parameters to functions and only warns
> for that with -fwhole-file ...

Well, that's not surprising - if the function is not in CONTAINS
(internal/module procedure) or in a module, the prototype is not available in
Fortran thus it is just an external procedure without any known interface (even
if it is just one line higher up).

One purpose of -fwhole-file is to allow to diagnose such things as error.

 * * *

I think this is fixed by the following patch. If I understand the code
correctly, we currently only append the void_type_node if there is at least one
argument, which allows for "(...)" for procedures without any argument.


Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c   (Revision 150376)
+++ gcc/fortran/trans-types.c   (Arbeitskopie)
@@ -2324,8 +2324,7 @@ gfc_get_function_type (gfc_symbol * sym)
   while (nstr--)
     typelist = gfc_chainon_list (typelist, gfc_charlen_type_node);

-  if (typelist)
-    typelist = gfc_chainon_list (typelist, void_type_node);
+  typelist = gfc_chainon_list (typelist, void_type_node);

   if (alternate_return)
     type = integer_type_node;


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
  2009-08-03 23:17 ` [Bug fortran/40949] " burnus at gcc dot gnu dot org
@ 2009-08-04  8:14 ` rguenther at suse dot de
  2009-08-04 17:36 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenther at suse dot de @ 2009-08-04  8:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenther at suse dot de  2009-08-04 08:14 -------
Subject: Re:  FAIL: gfortran.dg/proc_ptr_7.f90

On Mon, 3 Aug 2009, burnus at gcc dot gnu dot org wrote:

> ------- Comment #1 from burnus at gcc dot gnu dot org  2009-08-03 23:17 -------
> > I see the Fortran FE accepts excess parameters to functions and only warns
> > for that with -fwhole-file ...
> 
> Well, that's not surprising - if the function is not in CONTAINS
> (internal/module procedure) or in a module, the prototype is not available in
> Fortran thus it is just an external procedure without any known interface (even
> if it is just one line higher up).

Ah, ok.

> One purpose of -fwhole-file is to allow to diagnose such things as error.
> 
>  * * *
> 
> I think this is fixed by the following patch. If I understand the code
> correctly, we currently only append the void_type_node if there is at least one
> argument, which allows for "(...)" for procedures without any argument.

Well, I think you are building a new fndecl at callsites with a
prototype that matches the actual arguments passed.

> Index: gcc/fortran/trans-types.c
> ===================================================================
> --- gcc/fortran/trans-types.c   (Revision 150376)
> +++ gcc/fortran/trans-types.c   (Arbeitskopie)
> @@ -2324,8 +2324,7 @@ gfc_get_function_type (gfc_symbol * sym)
>    while (nstr--)
>      typelist = gfc_chainon_list (typelist, gfc_charlen_type_node);
> 
> -  if (typelist)
> -    typelist = gfc_chainon_list (typelist, void_type_node);
> +  typelist = gfc_chainon_list (typelist, void_type_node);
> 
>    if (alternate_return)
>      type = integer_type_node;

That looks correct to me.

Richard.


-- 


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
  2009-08-03 23:17 ` [Bug fortran/40949] " burnus at gcc dot gnu dot org
  2009-08-04  8:14 ` rguenther at suse dot de
@ 2009-08-04 17:36 ` burnus at gcc dot gnu dot org
  2009-08-04 22:36 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-04 17:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2009-08-04 17:36 -------
Subject: Bug 40949

Author: burnus
Date: Tue Aug  4 17:35:59 2009
New Revision: 150465

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150465
Log:
2009-08-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40949
        * trans-types.c (gfc_get_function_type): Fix typelist of
        functions without argument.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-types.c


-- 


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-08-04 17:36 ` burnus at gcc dot gnu dot org
@ 2009-08-04 22:36 ` burnus at gcc dot gnu dot org
  2009-08-05 20:47 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-04 22:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2009-08-04 22:36 -------
FIXED on the trunk.


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-08-04 22:36 ` burnus at gcc dot gnu dot org
@ 2009-08-05 20:47 ` burnus at gcc dot gnu dot org
  2009-08-05 20:51 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-05 20:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2009-08-05 20:47 -------
Subject: Bug 40949

Author: burnus
Date: Wed Aug  5 20:47:19 2009
New Revision: 150500

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150500
Log:
2009-08-05  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40969
        Revert:
        2009-08-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/40949
        * trans-types.c (gfc_get_function_type): Fix typelist of
        functions without argument.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-types.c


-- 


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-08-05 20:47 ` burnus at gcc dot gnu dot org
@ 2009-08-05 20:51 ` burnus at gcc dot gnu dot org
  2009-08-12  1:42 ` bje at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-05 20:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2009-08-05 20:51 -------
Patch broke IA64 and was reverted (cf. 40969). Proper fix is PR 40976 which
should solve several of the remaining LTO problems as well.


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-08-05 20:51 ` burnus at gcc dot gnu dot org
@ 2009-08-12  1:42 ` bje at gcc dot gnu dot org
  2010-05-06 21:20 ` dfranke at gcc dot gnu dot org
  2010-05-07  8:43 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-08-12  1:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from bje at gcc dot gnu dot org  2009-08-12 01:42 -------
Confirmed, given that a test case is failing.


-- 

bje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-12 01:42:07
               date|                            |


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-08-12  1:42 ` bje at gcc dot gnu dot org
@ 2010-05-06 21:20 ` dfranke at gcc dot gnu dot org
  2010-05-07  8:43 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-06 21:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from dfranke at gcc dot gnu dot org  2010-05-06 21:20 -------
(In reply to comment #6)
> Patch broke IA64 and was reverted (cf. 40969). Proper fix is PR 40976 which
> should solve several of the remaining LTO problems as well.

With the above statement, is this PR still needed? Can it be closed?


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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


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

* [Bug fortran/40949] FAIL: gfortran.dg/proc_ptr_7.f90
  2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-05-06 21:20 ` dfranke at gcc dot gnu dot org
@ 2010-05-07  8:43 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-07  8:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2010-05-07 08:43 -------
The problem has been fixed on the LTO side.  The Frontend issues remain but
are tracked in PR40976.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-05-07  8:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-03 13:55 [Bug fortran/40949] New: FAIL: gfortran.dg/proc_ptr_7.f90 rguenth at gcc dot gnu dot org
2009-08-03 23:17 ` [Bug fortran/40949] " burnus at gcc dot gnu dot org
2009-08-04  8:14 ` rguenther at suse dot de
2009-08-04 17:36 ` burnus at gcc dot gnu dot org
2009-08-04 22:36 ` burnus at gcc dot gnu dot org
2009-08-05 20:47 ` burnus at gcc dot gnu dot org
2009-08-05 20:51 ` burnus at gcc dot gnu dot org
2009-08-12  1:42 ` bje at gcc dot gnu dot org
2010-05-06 21:20 ` dfranke at gcc dot gnu dot org
2010-05-07  8:43 ` rguenth 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).