public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31222]  New: Rejected: implicitly-typed dummys used in initialization expressions
@ 2007-03-16 12:42 burnus at gcc dot gnu dot org
  2007-03-16 15:05 ` [Bug fortran/31222] " fxcoudert at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-16 12:42 UTC (permalink / raw)
  To: gcc-bugs

Reported at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/100b8994f011019b/


The following program is rejected with:

bar.f90:5.17:
 dimension a(abs(mode)),b(int(dis))
                1
Error: 'a' argument of 'abs' intrinsic at (1) must be a numeric type
bar.f90:5.30:
 dimension a(abs(mode)),b(int(dis))
                             1
Error: 'a' argument of 'int' intrinsic at (1) must be a numeric type


-------------
program testprog
   call mysub1((/-2.0/), (/3.2/),-1, 1.0)
contains
subroutine mysub1(a,b,mode,dis)
 dimension a(abs(mode)),b(int(dis))
   write (*,*) abs(mode), nint(dis)
end subroutine
end program


-- 
           Summary: Rejected: implicitly-typed dummys used in initialization
                    expressions
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/31222] Rejected: implicitly-typed dummys used in initialization expressions
  2007-03-16 12:42 [Bug fortran/31222] New: Rejected: implicitly-typed dummys used in initialization expressions burnus at gcc dot gnu dot org
@ 2007-03-16 15:05 ` fxcoudert at gcc dot gnu dot org
  2007-03-16 15:07 ` fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-16 15:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-03-16 15:05 -------
*** Bug 31225 has been marked as a duplicate of this bug. ***


-- 

fxcoudert at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/31222] Rejected: implicitly-typed dummys used in initialization expressions
  2007-03-16 12:42 [Bug fortran/31222] New: Rejected: implicitly-typed dummys used in initialization expressions burnus at gcc dot gnu dot org
  2007-03-16 15:05 ` [Bug fortran/31222] " fxcoudert at gcc dot gnu dot org
@ 2007-03-16 15:07 ` fxcoudert at gcc dot gnu dot org
  2007-03-29 23:34 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-16 15:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2007-03-16 15:06 -------
Tobias, you beat me to it, I only got PR31225 :)

Here is the analysis I posted in my bug-report:

------------------------------------
The following valid code is rejected by gfortran: (When the lines giving
explicit type to mode and dis are uncommented, gfortran compiles it fine.)

$ cat a.f90     
subroutine mysub1(a,b,mode,dis)
!  integer :: mode
!  real :: dis
  dimension a(abs(mode)),b(int(dis))
  print *, mod
  write (*,*) abs(mode), nint(dis)
end subroutine

program testprog
  call mysub1((/1.,2./),(/1.,2.,3./),-2, 3.2)
end


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.1.3 4.2.0 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-16 15:06:50
               date|                            |


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


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

* [Bug fortran/31222] Rejected: implicitly-typed dummys used in initialization expressions
  2007-03-16 12:42 [Bug fortran/31222] New: Rejected: implicitly-typed dummys used in initialization expressions burnus at gcc dot gnu dot org
  2007-03-16 15:05 ` [Bug fortran/31222] " fxcoudert at gcc dot gnu dot org
  2007-03-16 15:07 ` fxcoudert at gcc dot gnu dot org
@ 2007-03-29 23:34 ` pault at gcc dot gnu dot org
  2007-04-05 21:00 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-29 23:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-03-30 00:34 -------
This fixes it and regtests OK

Paul

Index: gcc/fortran/check.c
===================================================================
*** gcc/fortran/check.c (revision 123183)
--- gcc/fortran/check.c (working copy)
*************** numeric_check (gfc_expr *e, int n)
*** 58,63 ****
--- 58,75 ----
    if (gfc_numeric_ts (&e->ts))
      return SUCCESS;

+   /* If the expression has not got a type, check if its namespace can
+      offer a default type.  */
+   if ((e->expr_type == EXPR_VARIABLE || e->expr_type == EXPR_VARIABLE)
+         && e->symtree->n.sym->ts.type == BT_UNKNOWN
+         && gfc_set_default_type (e->symtree->n.sym, 0,
+                                  e->symtree->n.sym->ns) == SUCCESS
+         && gfc_numeric_ts (&e->symtree->n.sym->ts))
+     {
+       e->ts = e->symtree->n.sym->ts;
+       return SUCCESS;
+     }
+
    gfc_error ("'%s' argument of '%s' intrinsic at %L must be a numeric type",
             gfc_current_intrinsic_arg[n], gfc_current_intrinsic, &e->where);


-- 

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|2007-03-16 15:06:50         |2007-03-30 00:34:40
               date|                            |


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


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

* [Bug fortran/31222] Rejected: implicitly-typed dummys used in initialization expressions
  2007-03-16 12:42 [Bug fortran/31222] New: Rejected: implicitly-typed dummys used in initialization expressions burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-03-29 23:34 ` pault at gcc dot gnu dot org
@ 2007-04-05 21:00 ` pault at gcc dot gnu dot org
  2007-04-07 20:21 ` pault at gcc dot gnu dot org
  2007-04-07 20:32 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-04-05 21:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-04-05 22:00 -------
I submitted a patch for this in:
http://gcc.gnu.org/ml/fortran/2007-04/msg00016.html

Paul


-- 


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


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

* [Bug fortran/31222] Rejected: implicitly-typed dummys used in initialization expressions
  2007-03-16 12:42 [Bug fortran/31222] New: Rejected: implicitly-typed dummys used in initialization expressions burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-04-05 21:00 ` pault at gcc dot gnu dot org
@ 2007-04-07 20:21 ` pault at gcc dot gnu dot org
  2007-04-07 20:32 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-04-07 20:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2007-04-07 21:21 -------
Subject: Bug 31222

Author: pault
Date: Sat Apr  7 21:20:49 2007
New Revision: 123643

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

        PR fortran/31222
        * check.c (numeric_check): If an expresson has not got a type,
        see if it is a symbol for which a default type applies.

2007-04-07  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/31222
        * gfortran.dg/default_numeric_type_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/default_numeric_type_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/31222] Rejected: implicitly-typed dummys used in initialization expressions
  2007-03-16 12:42 [Bug fortran/31222] New: Rejected: implicitly-typed dummys used in initialization expressions burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-04-07 20:21 ` pault at gcc dot gnu dot org
@ 2007-04-07 20:32 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-04-07 20:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2007-04-07 21:32 -------
Fixed on trumk

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


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

end of thread, other threads:[~2007-04-07 20:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-16 12:42 [Bug fortran/31222] New: Rejected: implicitly-typed dummys used in initialization expressions burnus at gcc dot gnu dot org
2007-03-16 15:05 ` [Bug fortran/31222] " fxcoudert at gcc dot gnu dot org
2007-03-16 15:07 ` fxcoudert at gcc dot gnu dot org
2007-03-29 23:34 ` pault at gcc dot gnu dot org
2007-04-05 21:00 ` pault at gcc dot gnu dot org
2007-04-07 20:21 ` pault at gcc dot gnu dot org
2007-04-07 20:32 ` 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).