public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/21177] New: wrong code with NULL()
@ 2005-04-23 13:45 jv244 at cam dot ac dot uk
  2005-04-23 15:20 ` [Bug fortran/21177] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2005-04-23 13:45 UTC (permalink / raw)
  To: gcc-bugs

The following should not abort:

MODULE MYMOD
INTERFACE TT
MODULE PROCEDURE TT_I,TT_R
END INTERFACE TT
CONTAINS
FUNCTION TT_I(X) RESULT(I)
  INTEGER :: I
  INTEGER,POINTER :: X
  I=1
END FUNCTION
FUNCTION TT_R(X) RESULT(I)
  INTEGER :: I
  REAL,POINTER :: X
  I=2
END FUNCTION
END MODULE MYMOD

USE MYMOD
REAL, POINTER :: R
INTEGER, POINTER :: I
INTEGER :: K
IF (TT(I).NE.1) CALL ABORT()
IF (TT(R).NE.2) CALL ABORT()
IF (TT(NULL(I)).NE.1) CALL ABORT()
IF (TT(NULL(R)).NE.2) CALL ABORT()
END

-- 
           Summary: wrong code with NULL()
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
@ 2005-04-23 15:20 ` pinskia at gcc dot gnu dot org
  2005-04-23 22:08 ` fxcoudert at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-23 15:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-23 15:20 -------
Confirmed, the real version is being called for both of the NULL()'s.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-23 15:20:54
               date|                            |


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
  2005-04-23 15:20 ` [Bug fortran/21177] " pinskia at gcc dot gnu dot org
@ 2005-04-23 22:08 ` fxcoudert at gcc dot gnu dot org
  2005-04-24 10:59 ` fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-04-23 22:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From fxcoudert at gcc dot gnu dot org  2005-04-23 22:07 -------
In interface.c, we use compare_parameter to match an actual argument to
one of the formal arguments. The type is used to determine which member
of the interface (tt_r or tt_i) we will call.

Unfortunately, compare_parameter has a special case for EXPR_NULL:

  if (actual->expr_type != EXPR_NULL
      && !gfc_compare_types (&formal->ts, &actual->ts))
    return 0;

That is: actual and formal arguments match if they have the same type,
unless the are NULL, in which case they always match (and the member of
the interface chosen for execution is the first one in the list, which in
the case of this PR is TT_R).

I'm not sure whether this restriction should be completely lifted, since
there must have been a reason why it was here in the first place...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
   Last reconfirmed|2005-04-23 15:20:54         |2005-04-23 22:07:59
               date|                            |


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
  2005-04-23 15:20 ` [Bug fortran/21177] " pinskia at gcc dot gnu dot org
  2005-04-23 22:08 ` fxcoudert at gcc dot gnu dot org
@ 2005-04-24 10:59 ` fxcoudert at gcc dot gnu dot org
  2005-04-24 13:06 ` fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-04-24 10:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From fxcoudert at gcc dot gnu dot org  2005-04-24 10:59 -------
This test was introduced to fix PR 12841. Something more subtle is needed
(maybe, check not only for EXPR_NULL, but for EXPR_NULL with no type?).

-- 


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2005-04-24 10:59 ` fxcoudert at gcc dot gnu dot org
@ 2005-04-24 13:06 ` fxcoudert at gcc dot gnu dot org
  2005-04-25 13:35 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-04-24 13:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From fxcoudert at gcc dot gnu dot org  2005-04-24 13:06 -------
Found a patch (after a good night's sleep, it seemed to easy!):

Instead of 
  if (actual->expr_type != EXPR_NULL
      && !gfc_compare_types (&formal->ts, &actual->ts))
    return 0;
we need to use
  if ((actual->expr_type != EXPR_NULL ||
       actual->ts.type != BT_UNKNOWN)
      && !gfc_compare_types (&formal->ts, &actual->ts))
    return 0;

I'm regtesting it right now, and will post it in good form on monday (internet
dial-up access problems).

-- 


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2005-04-24 13:06 ` fxcoudert at gcc dot gnu dot org
@ 2005-04-25 13:35 ` pinskia at gcc dot gnu dot org
  2005-04-27 15:38 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-25 13:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-25 13:31 -------
Patch was posted.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |04/msg02578.html
           Keywords|                            |patch


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2005-04-25 13:35 ` pinskia at gcc dot gnu dot org
@ 2005-04-27 15:38 ` cvs-commit at gcc dot gnu dot org
  2005-04-27 15:43 ` cvs-commit at gcc dot gnu dot org
  2005-04-27 15:45 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-27 15:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-27 15:38 -------
Subject: Bug 21177

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	fxcoudert@gcc.gnu.org	2005-04-27 15:37:55

Modified files:
	gcc/fortran    : ChangeLog interface.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: pr21177.f90 

Log message:
	PR fortran/21177
	
	* interface.c (compare_parameter): Ignore type for EXPR_NULL
	only if type is BT_UNKNOWN.
	
	* gfortran.dg/pr21177.f90: New test

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.406&r2=1.407
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/interface.c.diff?cvsroot=gcc&r1=1.17&r2=1.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5405&r2=1.5406
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/pr21177.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
                   ` (5 preceding siblings ...)
  2005-04-27 15:38 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-27 15:43 ` cvs-commit at gcc dot gnu dot org
  2005-04-27 15:45 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-27 15:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-27 15:43 -------
Subject: Bug 21177

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	fxcoudert@gcc.gnu.org	2005-04-27 15:42:54

Modified files:
	gcc/fortran    : ChangeLog interface.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: pr21177.f90 

Log message:
	PR fortran/21177
	
	* interface.c (compare_parameter): Ignore type for EXPR_NULL
	only if type is BT_UNKNOWN.
	
	* gfortran.dg/pr21177.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.39&r2=1.335.2.40
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/interface.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.15&r2=1.15.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.141&r2=1.5084.2.142
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/pr21177.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug fortran/21177] wrong code with NULL()
  2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
                   ` (6 preceding siblings ...)
  2005-04-27 15:43 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-27 15:45 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-04-27 15:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From fxcoudert at gcc dot gnu dot org  2005-04-27 15:44 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.1


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


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

end of thread, other threads:[~2005-04-27 15:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-23 13:45 [Bug fortran/21177] New: wrong code with NULL() jv244 at cam dot ac dot uk
2005-04-23 15:20 ` [Bug fortran/21177] " pinskia at gcc dot gnu dot org
2005-04-23 22:08 ` fxcoudert at gcc dot gnu dot org
2005-04-24 10:59 ` fxcoudert at gcc dot gnu dot org
2005-04-24 13:06 ` fxcoudert at gcc dot gnu dot org
2005-04-25 13:35 ` pinskia at gcc dot gnu dot org
2005-04-27 15:38 ` cvs-commit at gcc dot gnu dot org
2005-04-27 15:43 ` cvs-commit at gcc dot gnu dot org
2005-04-27 15:45 ` fxcoudert 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).