[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-05 Thread anlauf at gmx dot de


--- Comment #12 from anlauf at gmx dot de  2006-05-05 07:09 ---
(In reply to comment #11)

 I've looked at the problem.  The -Wall option will set the -Wnonstd-intrinsic
 option.  This flag appears to trigger a warning when used with -pedantic.
 It does not trigger a warning if you use it with just -std=f95.

I am getting rather confused now.

I would like to compile code that (with regard to language)
is mostly strict Fortran 95 *except* using the rather common
intrinsic extensions iargc and getarg.  Therefore I use
-std=f95 -Wall, but not -pedantic, because I also use
other people's code that I do not want to fix.  If something 
does not strictly adhere to the standard, getting a warning is
fine, but stopping with an error is annoying.  (This is how I
used g77 and why I liked it very much.  Easy to handle.)

BTW: I just checked -Wnonstd-intrinsics (did not know about it before)
and found that I cannot turn it off by using -Wno-nonstd-intrinsics.
I guess that this is a bug.

Back to your suggestion:

 I have a patch that will turn this back into a warning.  Will this
 make you happy?
 
 troutmask:sgk[255] gfc4x -std=f95 -fall-intrinsics -Wnonstd-intrinsics -o z
 iargc.f90
  In file iargc.f90:5
 
print *, iargc()
   1
 Warning: Intrinsic 'iargc' at (1) is not included in the selected standard
 troutmask:sgk[256] ./z 2
1
 

Any chance that -std=f95 -Wall -fall-intrinsics could do the same,
maybe (*cough*) without (*cough*) a warning, needless to say an error?
If I want a warning even with -fall-intrinsics, I would turn it on
again with -Wnonstd-intrinsics.

Cheers,
-ha


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-05 Thread sgk at troutmask dot apl dot washington dot edu


--- Comment #13 from sgk at troutmask dot apl dot washington dot edu  
2006-05-05 14:25 ---
Subject: Re:  gfortran: intrinsics and std=f95, inconsistency with other
compilers

On Fri, May 05, 2006 at 07:09:37AM -, anlauf at gmx dot de wrote:
 
 
 --- Comment #12 from anlauf at gmx dot de  2006-05-05 07:09 ---
 (In reply to comment #11)
 
  I've looked at the problem.  The -Wall option will set the 
  -Wnonstd-intrinsic
  option.  This flag appears to trigger a warning when used with -pedantic.
  It does not trigger a warning if you use it with just -std=f95.
 
 I am getting rather confused now.

You're not the only one. :)  gfortran is growing a rather
large set of options and checking the interaction among
them is a pain.

 BTW: I just checked -Wnonstd-intrinsics (did not know about it before)
 and found that I cannot turn it off by using -Wno-nonstd-intrinsics.
 I guess that this is a bug.

I would need to look at options.c to see how the flag is
set.  I'm surprise that the no- form isn't available.

 
  troutmask:sgk[255] gfc4x -std=f95 -fall-intrinsics -Wnonstd-intrinsics -o z
  iargc.f90
   In file iargc.f90:5
  
 print *, iargc()
1
  Warning: Intrinsic 'iargc' at (1) is not included in the selected standard
  troutmask:sgk[256] ./z 2
  
 
 Any chance that -std=f95 -Wall -fall-intrinsics could do the same,
 maybe (*cough*) without (*cough*) a warning, needless to say an error?

Sure. I can make it do this. 


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-05 Thread sgk at troutmask dot apl dot washington dot edu


--- Comment #14 from sgk at troutmask dot apl dot washington dot edu  
2006-05-05 17:09 ---
Subject: Re:  gfortran: intrinsics and std=f95, inconsistency with other
compilers

On Fri, May 05, 2006 at 07:09:37AM -, anlauf at gmx dot de wrote:
 
 Any chance that -std=f95 -Wall -fall-intrinsics could do the same,
 maybe (*cough*) without (*cough*) a warning, needless to say an error?
 If I want a warning even with -fall-intrinsics, I would turn it on
 again with -Wnonstd-intrinsics.
 
 Harald,

How does this look to you?

% gfc4x -o z -std=f95 iargc.f90
/home/sgk/tmp/ccSftiWA.o(.text+0x55): In function `MAIN__':
: undefined reference to `iargc_'
collect2: ld returned 1 exit status
% gfc4x -o z -std=f95 -fall-intrinsics iargc.f90
% gfc4x -o z -std=f95 -fall-intrinsics -Wall iargc.f90
% gfc4x -o z -std=f95 -fall-intrinsics -Wnonstd-intrinsics iargc.f90
% gfc4x -o z -std=f95 -fall-intrinsics -Wno-nonstd-intrinsics iargc.f90
% gfc4x -o z -pedantic -Wno-nonstd-intrinsics iargc.f90
% gfc4x -o z -pedantic -Wnonstd-intrinsics iargc.f90
 In file iargc.f90:5

   print *, iargc()
  1
Warning: Intrinsic 'iargc' at (1) is not included in the selected standard
% gfc4x -o z -pedantic -Wall iargc.f90
 In file iargc.f90:5

   print *, iargc()
  1
Warning: Intrinsic 'iargc' at (1) is not included in the selected standard


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-05 Thread anlauf at gmx dot de


--- Comment #15 from anlauf at gmx dot de  2006-05-05 22:44 ---
(In reply to comment #14)

 How does this look to you?

Steve,

this is perfect!

Many thanks,
-ha


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-05 Thread kargl at gcc dot gnu dot org


--- Comment #16 from kargl at gcc dot gnu dot org  2006-05-05 23:19 ---
Fixed, again. ;-)


-- 

kargl at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.2.0


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-04 Thread anlauf at gmx dot de


--- Comment #10 from anlauf at gmx dot de  2006-05-04 07:22 ---
(In reply to comment #9)
 Fixed by the additional of -fall-intrinsics option.

Steve,

the -fall-intrinsics option does not work when
in addition -Wall is specified.

The original code the leads to:

 In file iargc.f90:4

print *, iargc ()
   1
Error: Intrinsic 'iargc' at (1) is not included in the selected standard


-- 

anlauf at gmx dot de changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|FIXED   |


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-04 Thread kargl at gcc dot gnu dot org


--- Comment #11 from kargl at gcc dot gnu dot org  2006-05-04 22:04 ---
Harald,

I've looked at the problem.  The -Wall option will set the -Wnonstd-intrinsic
option.  This flag appears to trigger a warning when used with -pedantic.
It does not trigger a warning if you use it with just -std=f95.

troutmask:sgk[254] gfc4x -std=f95 -Wnonstd-intrinsics -o z iargc.f90
/home/sgk/tmp/ccaTswTS.o(.text+0x55): In function `MAIN__':
: undefined reference to `iargc_'
collect2: ld returned 1 exit status

which by now looks familiar to you.

With -std=f95 -fall-intrinsic -Wall., gfortran added iargc to the
list of intrinsics and set -Wnonstd-intrinsics to trigger a warning.
However, the -std=f95 was telling gfc_notify_std to convert the
warning to an error.

I have a patch that will turn this back into a warning.  Will this
make you happy?

troutmask:sgk[255] gfc4x -std=f95 -fall-intrinsics -Wnonstd-intrinsics -o z
iargc.f90
 In file iargc.f90:5

   print *, iargc()
  1
Warning: Intrinsic 'iargc' at (1) is not included in the selected standard
troutmask:sgk[256] ./z 2
   1


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-03 Thread kargl at gcc dot gnu dot org


--- Comment #8 from kargl at gcc dot gnu dot org  2006-05-03 21:24 ---
Subject: Bug 20248

Author: kargl
Date: Wed May  3 21:24:11 2006
New Revision: 113502

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=113502
Log:
2006-03-30  Steven G. Kargl  [EMAIL PROTECTED]

PR fortran/26896
* lang.opt: Fix -Wtab description

PR fortran/20248 
* lang.opt: New flag -fall-intrinsics.
* invoke.texi:  Document option.
* gfortran.h (options_t):  New member flag_all_intrinsics.
* options.c (gfc_init_options, gfc_handle_option): Set new option.
sort nearby misplaced options.
* intrinsic.c (add_sym, make_generic, make_alias):  Use it.

2006-03-30  Steven G. Kargl  [EMAIL PROTECTED]

* gfortran.dg/iargc.f90:  New test.



Added:
trunk/gcc/testsuite/gfortran.dg/iargc.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/intrinsic.c
trunk/gcc/fortran/invoke.texi
trunk/gcc/fortran/lang.opt
trunk/gcc/fortran/options.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-05-03 Thread kargl at gcc dot gnu dot org


--- Comment #9 from kargl at gcc dot gnu dot org  2006-05-03 21:26 ---
Fixed by the additional of -fall-intrinsics option.


-- 

kargl at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED
Version|4.0.0   |4.2.0


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-03-26 Thread kargl at gcc dot gnu dot org


--- Comment #6 from kargl at gcc dot gnu dot org  2006-03-27 00:08 ---
I have a patch for this problem.  It implements a new flag that
prevents gfortran's enforcement of the Standard with respect to
gfortran's rich set of intrinsics.

program z
   if (iargc() /= 0) call abort
end program z

kargl[227] gfc4x -o z iargc.f90
kargl[228] gfc4x -o z -fall-intrinsics -std=f95 iargc.f90
kargl[229] gfc4x -o z -std=f95 iargc.f90
/var/tmp/ccqDOkrX.o(.text+0x18): In function `MAIN__':
: undefined reference to `iargc_'
collect2: ld returned 1 exit status

I'll post the patch tomorrow.

Harald, does this satisfy your needs?


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2006-03-26 Thread anlauf at gmx dot de


--- Comment #7 from anlauf at gmx dot de  2006-03-27 07:32 ---
 kargl[228] gfc4x -o z -fall-intrinsics -std=f95 iargc.f90
 kargl[229] gfc4x -o z -std=f95 iargc.f90
 /var/tmp/ccqDOkrX.o(.text+0x18): In function `MAIN__':
 : undefined reference to `iargc_'
 collect2: ld returned 1 exit status
 
 Harald, does this satisfy your needs?

Yes, that's fine with me.

Thanks,
-ha


-- 


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



[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2005-06-23 Thread anlauf at hep dot tu-darmstadt dot de

--- Additional Comments From anlauf at hep dot tu-darmstadt dot de  
2005-06-23 07:42 ---
In order to retain the advantages of having -std=f95 and
common intrinsic extensions, I suggest to enable the latter
by a suitable compiler option.  g77 did this.
g95 does this with -fintrinsic-extensions.

-- 


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


[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2005-03-01 Thread anlauf at hep dot tu-darmstadt dot de

--- Additional Comments From anlauf at hep dot tu-darmstadt dot de  
2005-03-01 08:33 ---
(In reply to comment #3)
 Read the F2003 standard.
 
 5.1.2.8INTRINSIC attribute
 The INTRINSIC attribute confirms that a name is the specific name (13.6) or
 generic name (13.5) of an intrinsic procedure.

OK

 When you set -std=f95, iargc is not an intrinsic procedure.  So, when
 you ask gfortran to *confirm* that iargc is an intrinsic procedure,
 it tells that it isn't.  The default behavior for gfortran is -std=gnu,
 which makes iargc an intrinsic procedure.

It is OK to reject iargc as an intrinsic procedure in the -std=f95 case
during compilation, but the failure during linking when iargc is not
specified as an intrinsic isn't.

The Intel compiler (v8.1) resolves the problem as follows:
- it does not change the name mapping/mangling when -stand=f95 is specified
- it maps the recognized intrinsic iargc to for_iargc when it is
  requested as an intrinsic or not specified as external
- it is mangled to iargc_ when specified as external
- it provides entry points in the runtime for both iargc_ and for_iargc
  (disassembling the runtime shows that both have identical code).

The version 7.1 of the compiler had the VAX/U*ix intrinsics in a
separate portability library.

g77 recognized several options to disable special intrinsics.
In the case of iargc, g77 -funix-intrinsics-disable does the job.
g95 does not recognize this option, and having -std=f95 doing too
many things behind my back is counterproductive.

-- 


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


[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2005-02-28 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-28 
13:39 ---
This is expected behavor because iargc is non standard and we turn off non 
standard intrisics with 
-std=f95 (kinda like what gcc does for non stanadard builtins) and that iargc 
is not _iargc really but 
_gfortran_iargc.

-- 
   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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


[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2005-02-28 Thread anlauf at hep dot tu-darmstadt dot de

--- Additional Comments From anlauf at hep dot tu-darmstadt dot de  
2005-02-28 22:11 ---
But is it consistently handled as an intrinsic?
Modify the program by adding the line

intrinsic :: iargc

and compile without -std=f95.
Now the name gets mapped to _gfortran_iargc, which is reasonable.
If I declare it as external, then it becomes iargc_.  So far so good.

Adding -std=f95 makes the compilation fail with the error message

 In file iargc.f90:3

integer :: iargc
   1
Error: Intrinsic at (1) does not exist

but only if iargc is declared as intrinsic.

Thus, a symbol that is _neither_ declared as intrinsic nor external
can change its behavior under the language level flag: it is mapped
to the intrinsic name in one case (no -std=f95), and to the
external name in the other.

This is why I consider it surprising and undesirable.
A better way would be to have a separate flag to control
the behavior and availability of such intrinsics separately,
independent of the standard conformance flags.

-- 
   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |


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


[Bug fortran/20248] gfortran: intrinsics and std=f95, inconsistency with other compilers

2005-02-28 Thread sgk at troutmask dot apl dot washington dot edu

--- Additional Comments From sgk at troutmask dot apl dot washington dot 
edu  2005-03-01 01:02 ---
Read the F2003 standard.

5.1.2.8INTRINSIC attribute
The INTRINSIC attribute confirms that a name is the specific name (13.6) or
generic name (13.5) of an intrinsic procedure.

When you set -std=f95, iargc is not an intrinsic procedure.  So, when
you ask gfortran to *confirm* that iargc is an intrinsic procedure,
it tells that it isn't.  The default behavior for gfortran is -std=gnu,
which makes iargc an intrinsic procedure.



-- 


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