public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions
@ 2005-03-04 19:57 tow21 at cam dot ac dot uk
  2005-03-09 16:01 ` [Bug fortran/20323] " Thomas dot Koenig at online dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tow21 at cam dot ac dot uk @ 2005-03-04 19:57 UTC (permalink / raw)
  To: gcc-bugs

In the program below, the optional argument arg is used as part of the 
specification expression for the length of a string. This is forbidden by 
section 7.1.6.2; constraint (2) of the F95 standard (and wouldn't make 
much sense anyway - what happens when the function is called without the 
optional argument?) 
 
gfortran accepts it without complaint, though. 
 
parabrisas:~/test% cat testpresent.f90  
function testpresent(arg) 
   integer, intent(in), optional :: arg 
   character(len=arg) :: s 
   logical :: testpresent 
 
   testpresent=.true. 
 
end function testpresent 
parabrisas:~/test% gfortran -c testpresent.f90  
parabrisas:~/test% gfortran -v 
Using built-in specs. 
Configured with: ../gcc/configure --prefix=/home/tow/root/gcc-4.0 
--enable-languages=c,f95 : (reconfigured) ../gcc/configure 
--prefix=/home/tow/root/gcc-4.0 
--with-gcc-version-trigger=/home/tow/dl/gcc/gcc/gcc/version.c 
--enable-languages=c,f95 --no-create --no-recursion : 
(reconfigured) ../gcc/configure --prefix=/home/tow/root/gcc-4.0 
--with-gcc-version-trigger=/home/tow/dl/gcc/gcc/gcc/version.c 
--enable-languages=c,f95 --no-create --no-recursion 
Thread model: posix 
gcc version 4.0.0 20050127 (experimental)

-- 
           Summary: optional arguments incorrectly accepted in specification
                    expressions
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tow21 at cam dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
@ 2005-03-09 16:01 ` Thomas dot Koenig at online dot de
  2005-03-09 16:12 ` tow21 at cam dot ac dot uk
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-03-09 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Thomas dot Koenig at online dot de  2005-03-09 16:01 -------
The complaint is a segfault at runtime when
you actually want to do anything with the
string whose length depends on a missing
optional argument.  This isn't too bad (the
same thing happens if you access a missing
optional argument).

Thomas

-- 


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


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
  2005-03-09 16:01 ` [Bug fortran/20323] " Thomas dot Koenig at online dot de
@ 2005-03-09 16:12 ` tow21 at cam dot ac dot uk
  2005-03-12 23:37 ` tobi at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tow21 at cam dot ac dot uk @ 2005-03-09 16:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tow21 at cam dot ac dot uk  2005-03-09 16:11 -------
 (In reply to comment #1) 
> The complaint is a segfault at runtime when 
> you actually want to do anything with the 
> string whose length depends on a missing 
> optional argument.  This isn't too bad (the 
> same thing happens if you access a missing 
> optional argument). 
 
Indeed - but even if the optional argument were present, you're still not 
allowed to access it in a specification expression, and this is a constraint 
that the compiler is required to detect at compile time. (It's a constraint 
that I'd quite like to see partially lifted - it would be very useful to be 
able to use present(arg) as part of a specification expression -  but it is 
forbidden according to the current standard.) 
 

-- 


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


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
  2005-03-09 16:01 ` [Bug fortran/20323] " Thomas dot Koenig at online dot de
  2005-03-09 16:12 ` tow21 at cam dot ac dot uk
@ 2005-03-12 23:37 ` tobi at gcc dot gnu dot org
  2005-03-13 17:23 ` tobi at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-03-12 23:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-12 23:37:20
               date|                            |


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


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2005-03-12 23:37 ` tobi at gcc dot gnu dot org
@ 2005-03-13 17:23 ` tobi at gcc dot gnu dot org
  2005-03-13 18:37 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-03-13 17:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2005-03-13 17:23 -------
Patch here: http://gcc.gnu.org/ml/fortran/2005-03/msg00220.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2005-03-13 17:23 ` tobi at gcc dot gnu dot org
@ 2005-03-13 18:37 ` cvs-commit at gcc dot gnu dot org
  2005-03-13 18:40 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-13 18:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-13 18:37 -------
Subject: Bug 20323

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tobi@gcc.gnu.org	2005-03-13 18:37:17

Modified files:
	gcc/fortran    : ChangeLog resolve.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: spec_expr_1.f90 

Log message:
	fortran/
	PR fortran/20323
	* resolve.c (gfc_resolve): Check if character lengths are
	specification expressions.
	
	testsuite/
	PR fortran/20323
	* gfortran.dg/spec_expr_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.349&r2=1.350
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&r1=1.35&r2=1.36
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5154&r2=1.5155
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/spec_expr_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2005-03-13 18:37 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-13 18:40 ` cvs-commit at gcc dot gnu dot org
  2005-03-13 18:42 ` tobi at gcc dot gnu dot org
  2005-03-13 18:44 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-13 18:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-13 18:40 -------
Subject: Bug 20323

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	tobi@gcc.gnu.org	2005-03-13 18:40:29

Modified files:
	gcc/fortran    : ChangeLog resolve.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: spec_expr_1.f90 

Log message:
	fortran/
	> PR fortran/20323
	> * resolve.c (gfc_resolve): Check if character lengths are
	> specification expressions.
	>
	> testsuite/
	> PR fortran/20323
	> * gfortran.dg/spec_expr_1.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.10&r2=1.335.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.34.2.1&r2=1.34.2.2
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.38&r2=1.5084.2.39
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/spec_expr_1.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=20323


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
                   ` (5 preceding siblings ...)
  2005-03-13 18:40 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-13 18:42 ` tobi at gcc dot gnu dot org
  2005-03-13 18:44 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-03-13 18:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2005-03-13 18:42 -------
Fixed.

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


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


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

* [Bug fortran/20323] optional arguments incorrectly accepted in specification expressions
  2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
                   ` (6 preceding siblings ...)
  2005-03-13 18:42 ` tobi at gcc dot gnu dot org
@ 2005-03-13 18:44 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-13 18:44 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2005-03-13 18:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-04 19:57 [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions tow21 at cam dot ac dot uk
2005-03-09 16:01 ` [Bug fortran/20323] " Thomas dot Koenig at online dot de
2005-03-09 16:12 ` tow21 at cam dot ac dot uk
2005-03-12 23:37 ` tobi at gcc dot gnu dot org
2005-03-13 17:23 ` tobi at gcc dot gnu dot org
2005-03-13 18:37 ` cvs-commit at gcc dot gnu dot org
2005-03-13 18:40 ` cvs-commit at gcc dot gnu dot org
2005-03-13 18:42 ` tobi at gcc dot gnu dot org
2005-03-13 18:44 ` pinskia 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).