public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34495]  New: [4.3 Regression] accepts invalid initialization expressions with -std=f95
@ 2007-12-16 13:38 tkoenig at gcc dot gnu dot org
  2007-12-16 14:35 ` [Bug fortran/34495] " burnus at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-12-16 13:38 UTC (permalink / raw)
  To: gcc-bugs

Adapted from a test case from c.l.f, from James van Buskirk
:
$ cat foo.f90 
program main
   integer, parameter :: ipi = 1078530011
   real pi
   parameter(pi=transfer(ipi,pi))
   real, parameter :: z = transfer(ipi,z)
   real, parameter :: y = real(1,kind(y))

   write(*,*) pi, z, y
end
$ gfortran -std=f95 -pedantic foo.f90 
$ ./a.out
   3.1415927       3.1415927      1.00000000 

JvB's explanation:

# the second
# and third treat transfer as a specification inquiry even thought
# that is not permitted even in f03, and the fourth has that pesky
# REAL intrinsic, which is not an elemental function of type integer
# or character.

gfortran 4.2 still generates some error messages:

$ gfortran-4.2 foo.f90 
foo.f90:4.29:

   parameter(pi=transfer(ipi,pi))
                            1
Error: Parameter 'pi' at (1) has not been declared or is a variable, which does
not reduce to a constant expression
foo.f90:5.35:

   real, parameter :: z = transfer(ipi,z)
                                  1
Error: TRANSFER intrinsic not implemented for initialization at (1)


-- 
           Summary: [4.3 Regression] accepts invalid initialization
                    expressions with -std=f95
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions with -std=f95
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
@ 2007-12-16 14:35 ` burnus at gcc dot gnu dot org
  2007-12-16 15:15 ` burnus at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-16 14:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-12-16 14:35 -------
Confirm. Though other compilers have better error messages than 4.2 had. (These
are all shown by default, i.e. none of the compilers below accepts it.)

NAG f95:
  Error: PARAMETER PI used before its definition is complete
g95:
  Error: PARAMETER value is used before being defined at (1)
ifort:
  Error: A PARAMETER must not be defined in terms of itself.   [PI]
(sunf95 and openf95 have also not a good message.)

I think for -std=f95 one needs another error. NAG f95 prints:
  Error: The REAL function is not permitted in an initialisation expression

I am also not sure whether I would call the following a regression:
> Error: TRANSFER intrinsic not implemented for initialization at (1)


-- 

burnus 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-12-16 14:35:24
               date|                            |


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions with -std=f95
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
  2007-12-16 14:35 ` [Bug fortran/34495] " burnus at gcc dot gnu dot org
@ 2007-12-16 15:15 ` burnus at gcc dot gnu dot org
  2007-12-16 22:13 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-16 15:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-12-16 15:14 -------
Created an attachment (id=14779)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14779&action=view)
Patch - only for the REAL()/CMPLX() diagnostics


-- 


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions with -std=f95
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
  2007-12-16 14:35 ` [Bug fortran/34495] " burnus at gcc dot gnu dot org
  2007-12-16 15:15 ` burnus at gcc dot gnu dot org
@ 2007-12-16 22:13 ` burnus at gcc dot gnu dot org
  2007-12-16 22:14 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-16 22:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-12-16 22:13 -------
Subject: Bug 34495

Author: burnus
Date: Sun Dec 16 22:12:55 2007
New Revision: 130994

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130994
Log:
2007-12-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34495
        * intrinsic.c (add_functions): Mark float and sngl as STD_GNU.
        (gfc_intrinsic_func_interface): Reject REAL, DBLE and CMPLX
        in initialization expressions for -std=f95.

2007-12-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34495
        * gfortran.dg/initialization_16.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/initialization_16.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions with -std=f95
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-12-16 22:13 ` burnus at gcc dot gnu dot org
@ 2007-12-16 22:14 ` burnus at gcc dot gnu dot org
  2007-12-17 14:35 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-16 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-12-16 22:14 -------
(From update of attachment 14779)
Still to do: Adding/Re-adding an error for:
  Error: PARAMETER PI used before its definition is complete


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14779|0                           |1
        is obsolete|                            |


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions with -std=f95
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-12-16 22:14 ` burnus at gcc dot gnu dot org
@ 2007-12-17 14:35 ` burnus at gcc dot gnu dot org
  2007-12-17 18:45 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-17 14:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2007-12-17 14:35 -------
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/2ad94287d7f8a6f0/

Related for non parameters:
  real :: pi = transfer(123,pi)


-- 


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions with -std=f95
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-12-17 14:35 ` burnus at gcc dot gnu dot org
@ 2007-12-17 18:45 ` burnus at gcc dot gnu dot org
  2007-12-17 19:01 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-17 18:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2007-12-17 18:45 -------
Example why it should be forbidden also for -std=gnu/legacy:

implicit none
dimension :: i1(5)
integer :: i1 = transfer([1,2,3,4,5], i1)
integer :: i2 = transfer([1,2,3,4,5], i2)
dimension :: i2(5)
print *, i1 ! prints: 1 2 3 4 5
print *, i2 ! prints: 1 1 1 1 1
end


-- 


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions with -std=f95
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-12-17 18:45 ` burnus at gcc dot gnu dot org
@ 2007-12-17 19:01 ` burnus at gcc dot gnu dot org
  2007-12-17 22:34 ` [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions withTRANSFER dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-17 19:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2007-12-17 19:01 -------
In words of the standard (esp. last sentence):

"If an initialization expression includes a specification inquiry that depends
on a type parameter or an array bound of an entity specified in the same
specification-part, the type parameter or array bound shall be specified in a
prior specification of the specification-part. The prior specification may be
to the left of the specification inquiry in the same statement, but shall not
be within the same entity-decl."


-- 


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions withTRANSFER
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-12-17 19:01 ` burnus at gcc dot gnu dot org
@ 2007-12-17 22:34 ` dfranke at gcc dot gnu dot org
  2007-12-18 23:40 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-12-17 22:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from dfranke at gcc dot gnu dot org  2007-12-17 22:34 -------
Mine. Got a patch, but one more error message to fix ... 


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
         AssignedTo|unassigned at gcc dot gnu   |dfranke at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-16 14:35:24         |2007-12-17 22:34:31
               date|                            |
            Summary|[4.3 Regression] accepts    |[4.3 Regression] accepts
                   |invalid initialization      |invalid initialization
                   |expressions with -std=f95   |expressions withTRANSFER


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions withTRANSFER
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-12-17 22:34 ` [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions withTRANSFER dfranke at gcc dot gnu dot org
@ 2007-12-18 23:40 ` dfranke at gcc dot gnu dot org
  2007-12-18 23:41 ` dfranke at gcc dot gnu dot org
  2007-12-18 23:42 ` dfranke at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-12-18 23:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from dfranke at gcc dot gnu dot org  2007-12-18 23:40 -------
Subject: Bug 34495

Author: dfranke
Date: Tue Dec 18 23:39:56 2007
New Revision: 131047

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131047
Log:
gcc/fortran:
2007-12-19  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/34495
        * expr.c (check_init_expr): Check whether variables with flavor
        FL_PARAMETER do have a value assigned. Added error messages where
        appropriate.
        * simplify.c (gfc_simplify_transfer): Added check if the MOLD
        argument is a constant if working with initialization
        expressions.

gcc/testsuite:
2007-12-19  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/34495
        * gfortran.dg/transfer_simplify_2.f90: Fixed invalid initialization
        expressions.
        * gfortran.dg/transfer_simplify_7.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/transfer_simplify_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/transfer_simplify_2.f90


-- 


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions withTRANSFER
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-12-18 23:40 ` dfranke at gcc dot gnu dot org
@ 2007-12-18 23:41 ` dfranke at gcc dot gnu dot org
  2007-12-18 23:42 ` dfranke at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-12-18 23:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from dfranke at gcc dot gnu dot org  2007-12-18 23:41 -------
Fixed in trunk. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions withTRANSFER
  2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2007-12-18 23:41 ` dfranke at gcc dot gnu dot org
@ 2007-12-18 23:42 ` dfranke at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-12-18 23:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/fortra
                   |                            |n/2007-12/msg00236.html
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-12-18 23:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-16 13:38 [Bug fortran/34495] New: [4.3 Regression] accepts invalid initialization expressions with -std=f95 tkoenig at gcc dot gnu dot org
2007-12-16 14:35 ` [Bug fortran/34495] " burnus at gcc dot gnu dot org
2007-12-16 15:15 ` burnus at gcc dot gnu dot org
2007-12-16 22:13 ` burnus at gcc dot gnu dot org
2007-12-16 22:14 ` burnus at gcc dot gnu dot org
2007-12-17 14:35 ` burnus at gcc dot gnu dot org
2007-12-17 18:45 ` burnus at gcc dot gnu dot org
2007-12-17 19:01 ` burnus at gcc dot gnu dot org
2007-12-17 22:34 ` [Bug fortran/34495] [4.3 Regression] accepts invalid initialization expressions withTRANSFER dfranke at gcc dot gnu dot org
2007-12-18 23:40 ` dfranke at gcc dot gnu dot org
2007-12-18 23:41 ` dfranke at gcc dot gnu dot org
2007-12-18 23:42 ` dfranke 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).