public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30372]  New: kill intrinsic doesn't diagnose invalid argument kinds
@ 2007-01-04 20:33 brooks at gcc dot gnu dot org
  2007-01-23 15:17 ` [Bug fortran/30372] " fxcoudert at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: brooks at gcc dot gnu dot org @ 2007-01-04 20:33 UTC (permalink / raw)
  To: gcc-bugs

The kill intrinsic is only implemented in libgfortran for STATUS arguments of
types INTEGER(4) and INTEGER(8).  However, the implementation in
gfc_resolve_kill_sub will attempt to link to implementations for any kind that
it's given, rather than reporting an error.  Thus, the following little code
produces a rather unhelpful link-time error instead:

program kill2
  integer(kind=1) this
  call kill(99999, 0, this)
end

debian-gfortran:~/test> ../bin-trunk/bin/gfortran kill2.f90 -o kill2
/tmp/ccKohBjB.o(.text+0x3d): In function `MAIN__':
: undefined reference to `_gfortran_kill_i1_sub'
collect2: ld returned 1 exit status

This could be fixed with extra checks in check.c: gfc_resolve_kill_sub.


-- 
           Summary: kill intrinsic doesn't diagnose invalid argument kinds
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brooks at gcc dot gnu dot org


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


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

* [Bug fortran/30372] kill intrinsic doesn't diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
@ 2007-01-23 15:17 ` fxcoudert at gcc dot gnu dot org
  2007-02-11 19:39 ` dfranke at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-01-23 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-01-23 15:16 -------
Confirmed. It's worth noting that the doc says the right thing:

Arguments:
PID     Shall be a scalar INTEGER, with INTENT(IN) 
SIGNAL  Shall be a scalar INTEGER, with INTENT(IN) 
STATUS  (Optional) status flag of type INTEGER(4) or INTEGER(8). Returns 0 on
success, or a system-specific error code otherwise. 


-- 

fxcoudert 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         |2007-01-23 15:16:57
               date|                            |


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


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

* [Bug fortran/30372] kill intrinsic doesn't diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
  2007-01-23 15:17 ` [Bug fortran/30372] " fxcoudert at gcc dot gnu dot org
@ 2007-02-11 19:39 ` dfranke at gcc dot gnu dot org
  2007-02-11 20:43 ` kargl at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-02-11 19:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2007-02-11 19:39 -------
Contrary to this, the docs of g77-3.4.6 [1] state:
    Status: INTEGER(KIND=1); OPTIONAL; scalar; INTENT(OUT). 

Also, the comment at the beginning of libgfortran/intrinsics/kill.c [2] states:
/* SUBROUTINE KILL(PID, SIGNAL, STATUS)
   INTEGER, INTENT(IN) :: PID, SIGNAL
   INTEGER(KIND=1), INTENT(OUT), OPTIONAL :: STATUS

   INTEGER(KIND=1) FUNCTION KILL(PID, SIGNAL)
   INTEGER, INTENT(IN) :: PID, SIGNAL */

Thus, maybe libgfortran should provide `_gfortran_kill_i1_sub'?


[1]
http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Kill-Intrinsic-_0028subroutine_0029.html
[2] http://gcc.gnu.org/viewcvs/trunk/libgfortran/intrinsics/kill.c?view=markup


-- 

dfranke at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/30372] kill intrinsic doesn't diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
  2007-01-23 15:17 ` [Bug fortran/30372] " fxcoudert at gcc dot gnu dot org
  2007-02-11 19:39 ` dfranke at gcc dot gnu dot org
@ 2007-02-11 20:43 ` kargl at gcc dot gnu dot org
  2007-02-11 21:02 ` dfranke at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-02-11 20:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kargl at gcc dot gnu dot org  2007-02-11 20:43 -------
(In reply to comment #2)
> Contrary to this, the docs of g77-3.4.6 [1] state:
>     Status: INTEGER(KIND=1); OPTIONAL; scalar; INTENT(OUT). 
> 

INTEGER(KIND=1) in g77 is the default integer kind, which is
INTEGER(KIND=4) in gfortran.  What needs to be done is 
either fix check.c to disable non-default integer kinds or
fix iresolve.c to force type conversion.


-- 


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


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

* [Bug fortran/30372] kill intrinsic doesn't diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-02-11 20:43 ` kargl at gcc dot gnu dot org
@ 2007-02-11 21:02 ` dfranke at gcc dot gnu dot org
  2007-02-11 21:52 ` [Bug fortran/30372] various intrinsics do not " dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-02-11 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2007-02-11 21:02 -------
Ouch. Thanks for clarification.


-- 


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


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

* [Bug fortran/30372] various intrinsics do not diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-02-11 21:02 ` dfranke at gcc dot gnu dot org
@ 2007-02-11 21:52 ` dfranke at gcc dot gnu dot org
  2007-02-11 22:26 ` kargl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-02-11 21:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dfranke at gcc dot gnu dot org  2007-02-11 21:51 -------
Also affected:
chmod, exit, getcwd, hostnm, link, rename, sleep, system_clock, unlink, umask 
(maybe others).

SYSTEM_CLOCK accepts INTEGER(1) if exactly one or all of its optional arguments
are of that type.

UMASK(NEW[,OLD]) also accepts INTEGER(1) in its NEW argument if OLD is not
present.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|kill intrinsic doesn't      |various intrinsics do not
                   |diagnose invalid argument   |diagnose invalid argument
                   |kinds                       |kinds


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


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

* [Bug fortran/30372] various intrinsics do not diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-02-11 21:52 ` [Bug fortran/30372] various intrinsics do not " dfranke at gcc dot gnu dot org
@ 2007-02-11 22:26 ` kargl at gcc dot gnu dot org
  2007-02-23 20:42 ` burnus at gcc dot gnu dot org
  2007-02-23 21:02 ` sgk at troutmask dot apl dot washington dot edu
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-02-11 22:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from kargl at gcc dot gnu dot org  2007-02-11 22:26 -------
daniel,

It's just an inconsistency in implementations.  First, note that
FX and myself implemented a lot of the g77 intrinsics procedures
as our first foray into gfortran, so we may have missed some of the 
finer details.  For example, EXIT() actually accepts any integer
kind. I don't know if it's documented or not.  I'll note

laptop:kargl[210] cat > e.f90
program e
  integer(1) i1
  integer(2) i2
  integer(4) i4
  integer(8) i8
  call exit(i1)
  call exit(i2)
  call exit(i3)
  call exit(i8)
end program e
laptop:kargl[211] gfc4x -o z -fdump-tree-original e.f90
/usr/tmp/ccA5UbZ9.o(.text+0x1e): In function `MAIN__':
: undefined reference to `_gfortran_exit_i1'
collect2: ld returned 1 exit status
laptop:kargl[212] more e.f90.003t.original 
MAIN__ ()
{
  int2 i2;
  int1 i1;
  int8 i8;
  int4 i3;

  _gfortran_set_std (70, 127, 0, 0);
  _gfortran_exit_i1 (&i1);
  _gfortran_exit_i2 (&i2);
  _gfortran_exit_i4 (&i3);
  _gfortran_exit_i8 (&i8);
}

So, I think we need to audit the intrinsics to see were we need to 
fix up the inconsistencies and documentation.


-- 

kargl at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/30372] various intrinsics do not diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-02-11 22:26 ` kargl at gcc dot gnu dot org
@ 2007-02-23 20:42 ` burnus at gcc dot gnu dot org
  2007-02-23 21:02 ` sgk at troutmask dot apl dot washington dot edu
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-23 20:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2007-02-23 20:42 -------
> various intrinsics do not diagnose invalid argument kinds
The question is what is the right solution:
a) Only allow certain kinds
b) Allowing all kinds and doing the conversion/providing the needed functions.

(a) is in the spirit of Fortran 95, which allowed only the default kind for a
lot of arguments to intrinsic procedures
(b) is in the spirit of Fortran 2003 which lifted a lot of those restrictions.

For legacy intrinsics we have the choice, but I favour option (b).


-- 

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


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

* [Bug fortran/30372] various intrinsics do not diagnose invalid argument kinds
  2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-02-23 20:42 ` burnus at gcc dot gnu dot org
@ 2007-02-23 21:02 ` sgk at troutmask dot apl dot washington dot edu
  7 siblings, 0 replies; 9+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2007-02-23 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from sgk at troutmask dot apl dot washington dot edu  2007-02-23 21:02 -------
Subject: Re:  various intrinsics do not diagnose invalid argument kinds

On Fri, Feb 23, 2007 at 08:42:03PM -0000, burnus at gcc dot gnu dot org wrote:
> 
> 
> > various intrinsics do not diagnose invalid argument kinds
> The question is what is the right solution:
> a) Only allow certain kinds
> b) Allowing all kinds and doing the conversion/providing the needed functions.
> 
> (a) is in the spirit of Fortran 95, which allowed only the default kind for a
> lot of arguments to intrinsic procedures
> (b) is in the spirit of Fortran 2003 which lifted a lot of those restrictions.
> 
> For legacy intrinsics we have the choice, but I favour option (b).
> 

I agree that (b) is perhaps the best option.  Afterall, we are 
moving forward in time so gfortran will chase F2003 (and F2008).


-- 


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


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

end of thread, other threads:[~2007-02-23 21:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-04 20:33 [Bug fortran/30372] New: kill intrinsic doesn't diagnose invalid argument kinds brooks at gcc dot gnu dot org
2007-01-23 15:17 ` [Bug fortran/30372] " fxcoudert at gcc dot gnu dot org
2007-02-11 19:39 ` dfranke at gcc dot gnu dot org
2007-02-11 20:43 ` kargl at gcc dot gnu dot org
2007-02-11 21:02 ` dfranke at gcc dot gnu dot org
2007-02-11 21:52 ` [Bug fortran/30372] various intrinsics do not " dfranke at gcc dot gnu dot org
2007-02-11 22:26 ` kargl at gcc dot gnu dot org
2007-02-23 20:42 ` burnus at gcc dot gnu dot org
2007-02-23 21:02 ` sgk at troutmask dot apl dot washington dot edu

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).