From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org  Fri Dec 16 15:44:12 2011
Return-Path: <owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id EE36E356951; Fri, 16 Dec 2011 15:44:11 +0100 (CET)
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 1968 seconds by postgrey-1.34 at www5.open-std.org; Fri, 16 Dec 2011 15:44:09 CET
Received: from mail.antivirus.flexwebhosting.nl (220-178-18-89.static.mail.antivirus.flexwebhosting.nl [89.18.178.220])
	by www.open-std.org (Postfix) with ESMTP id 1ABDA356929
	for <sc22wg5@open-std.org>; Fri, 16 Dec 2011 15:44:08 +0100 (CET)
Received: from localhost (localhost.localdomain [127.0.0.1])
	by mail.antivirus.flexwebhosting.nl (Postfix) with ESMTP id 28833B7B8497;
	Fri, 16 Dec 2011 15:11:16 +0100 (CET)
X-Virus-Scanned: amavisd-new at mail.antivirus.flexwebhosting.nl
Received: from mail.antivirus.flexwebhosting.nl ([127.0.0.1])
	by localhost (mail.antivirus.flexwebhosting.nl [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id 93Wj5XJWfQFQ; Fri, 16 Dec 2011 15:11:15 +0100 (CET)
Received: from srv2059.flexwebhosting.nl (srv2059.flexwebhosting.nl [89.18.176.59])
	by mail.antivirus.flexwebhosting.nl (Postfix) with ESMTP id 99701B7B84C9;
	Fri, 16 Dec 2011 15:11:13 +0100 (CET)
Received: from 82-169-60-28.ip.telfort.nl ([82.169.60.28] helo=PCErik)
	by srv2059.flexwebhosting.nl with esmtp (Exim 4.60)
	(envelope-from <erik@forcheck.nl>)
	id 1RbYV8-0003if-Af; Fri, 16 Dec 2011 15:11:12 +0100
From: "Erik Kruyt" <erik@forcheck.nl>
To: "'N.M. Maclaren'" <nmm1@cam.ac.uk>,
	<sc22wg5@open-std.org>
References: <20111019141328.42FAD35690F@www.open-std.org> <20111120134657.46417356928@www.open-std.org> <20111216130512.2CFC335693B@www.open-std.org>
In-Reply-To: <20111216130512.2CFC335693B@www.open-std.org>
Subject: RE: (SC22WG5.4609) Is this obscure USE usage legal?
Date: Fri, 16 Dec 2011 15:11:03 +0100
Message-ID: <000c01ccbbfc$8bd86870$a3893950$@nl>
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_000D_01CCBC04.ED9CD070"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Acy781oZTsZ1BrX6Re+DVKoK91RE7gACOACA
Content-Language: nl
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

This is a multi-part message in MIME format.

------=_NextPart_000_000D_01CCBC04.ED9CD070
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Forcheck accepts this code without problems.

Erik Kruyt
Forcheck b.v.
Leiden
Netherlands

-----Oorspronkelijk bericht-----
Van: owner-sc22wg5@open-std.org [mailto:owner-sc22wg5@open-std.org] Namens
N.M. Maclaren
Verzonden: vrijdag 16 december 2011 14:05
Aan: sc22wg5@open-std.org
Onderwerp: (SC22WG5.4609) Is this obscure USE usage legal?

This arose on the gfortran mailing list.  I am 90% sure that there is a bug
in both gfortran and Intel, especially as Sun, Pathscale and NAG all accept
this code.  But I am only 90% sure, as it all hangs on exactly which scoping
unit the word 'local' applies to WHILE processing recursive inclusion!
Until this moment, it had never crossed my mind to query that.

Please tell me if I have missed something.

Regards,
Nick Maclaren.



module mod1
integer :: axx=2
end module mod1

module mod2
use mod1
end module mod2

subroutine sub1
use mod1, oxx=>axx
use mod2
implicit none
print*,axx   !line compiles OK for gfortran, fails for Intel
end subroutine sub1

subroutine sub2
use mod2
use mod1, oxx=>axx
implicit none
print*,axx  !line fails to compile for gfortran, OK for Intel end subroutine
sub2



------=_NextPart_000_000D_01CCBC04.ED9CD070
Content-Type: application/octet-stream;
	name="log"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="log"

      F O R C H E C K  (R)  V14.2.00
Copyright (c) 1984-2011  Forcheck b.v. All rights reserved
Licensed to: Erik Kruyt, Forcheck b.v., Leiden, NL
PC/Windows (+IDE), serial: 9611401
Maintenance expires: 2012-01-25

   -- gfortran compiler emulation

   -- Fortran 95 syntax

   -- commandline argument: con/ff,testje.f08;

   -- program unit analysis
FORCHECK PC V14.2.00  gfortran compiler emulation                  =
2011-12-16 15:07:48   page:     1
testje.f08  /FF


      1 module mod1
      2 integer :: axx=3D2
      3 end module mod1
=0C
FORCHECK PC V14.2.00                     MOD1                      =
2011-12-16 15:07:48   page:     2
testje.f08  /FF


ENTRY     TYPE RANK NARG LINES

   MOD1       M          1# 3


VARIABLE TYPE RANK SIZE OPERATIONS  LINES

   AXX    I           4     D       2#


Size of local static variables:         4 bytes
=0C
FORCHECK PC V14.2.00  gfortran compiler emulation                  =
2011-12-16 15:07:48   page:     3
testje.f08  /FF


      5 module mod2
      6 use mod1
      7 end module mod2
=0C
FORCHECK PC V14.2.00                     MOD2                      =
2011-12-16 15:07:48   page:     4
testje.f08  /FF


ENTRY     TYPE RANK NARG LINES

   MOD2       M          5# 7


VARIABLE TYPE RANK SIZE OPERATIONS  LINES

   AXX    I           4             6#


Size of local static variables:         0 bytes
=0C
FORCHECK PC V14.2.00  gfortran compiler emulation                  =
2011-12-16 15:07:48   page:     5
testje.f08  /FF


      9 subroutine sub1
     10 use mod1, oxx=3D>axx
     11 use mod2
     12 implicit none
     13 print*,axx   !line compiles OK for gfortran, fails for Intel
     14 end subroutine sub1
=0C
FORCHECK PC V14.2.00                     SUB1                      =
2011-12-16 15:07:48   page:     6
testje.f08  /FF


ENTRY     TYPE RANK NARG LINES

   SUB1       S       0   9# 14


VARIABLE TYPE RANK SIZE OPERATIONS  LINES

   AXX    I           4           O 11  13
   OXX    I           4             10#

(file: testje.f08, line: 10)
  OXX
**[681 I] not used


Size of local static variables:         0 bytes
=0C
FORCHECK PC V14.2.00  gfortran compiler emulation                  =
2011-12-16 15:07:48   page:     7
testje.f08  /FF


     16 subroutine sub2
     17 use mod2
     18 use mod1, oxx=3D>axx
     19 implicit none
     20 print*,axx  !line fails to compile for gfortran, OK for Intel =
end subroutine sub2
     21 end
=0C
FORCHECK PC V14.2.00                     SUB2                      =
2011-12-16 15:07:48   page:     8
testje.f08  /FF


ENTRY     TYPE RANK NARG LINES

   SUB2       S       0  16#


VARIABLE TYPE RANK SIZE OPERATIONS  LINES

   AXX    I           4           O 17  20
   OXX    I           4             18#

(file: testje.f08, line: 18)
  OXX
**[681 I] not used


Size of local static variables:         0 bytes
=0C
FORCHECK PC V14.2.00  gfortran compiler emulation                  =
2011-12-16 15:07:48   page:     9


Library files:

FILE                                                   CREATED AT        =
    LAST UPDATE

   C:\Program Files (x86)\Forcheck\share\INTRMODS.FLB  2011-10-06 =
10:06:27   2011-10-06 10:06:27


reference_structure:



      1  SUB1


    1.1  SUB2


global program analysis:



program_units and procedures analysed:

PROGRAM_UNIT                                      PROGRAM_UNIT
OR PROCEDURE    PAGE FILE                         OR PROCEDURE    PAGE =
FILE

   MOD1          1   testje.f08                      MOD2          3   =
testje.f08
   SUB1          5   testje.f08                      SUB2          7   =
testje.f08


cross_references:

PROGRAM_UNIT
OR PROCEDURE  TYPE RANK NARG SIZE DEFINED OR REFERENCED IN

   SUB1           S       0     0
   SUB2           S       0     0


MODULE  SIZE REFERENCED IN

   MOD1    4 MOD2   SUB1   SUB2
   MOD2    0 SUB1   SUB2


Total size of module data:         4 bytes

messages presented:

    2x[681 I] not used

number of informative messages:           2
=0C
FORCHECK PC V14.2.00  gfortran compiler emulation                  =
2011-12-16 15:07:48   page:    10


Metrics:
                                      total  not-included
number of noncomment source lines:       18            18
number of nonblank comment lines:         0             0
number of statements:                    18            18
number of program units:                  4
number of source files:                   1
number of modules used:                   2

Completed with information

Press enter to continue

------=_NextPart_000_000D_01CCBC04.ED9CD070--


