[Bug fortran/45823] Bogus warning for intrinsic module procedures

2011-05-12 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45823

Tobias Burnus  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED

--- Comment #3 from Tobias Burnus  2011-05-12 
17:45:15 UTC ---
FIXED.

Commit had the wrong PR number:

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173708
Log:
2011-05-12  Tobias Burnus  

PR fortran/48972
* resolve.c (resolve_intrinsic): Don't resolve module
intrinsics multiple times.

2011-05-12  Tobias Burnus  

PR fortran/48972
* gfortran.dg/iso_c_binding_compiler_3.f90: New.


[Bug fortran/45823] Bogus warning for intrinsic module procedures

2011-05-12 Thread thenlich at users dot sourceforge.net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45823

Thomas Henlich  changed:

   What|Removed |Added

 CC||thenlich at users dot
   ||sourceforge.net

--- Comment #1 from Thomas Henlich  
2011-05-12 09:40:37 UTC ---
Here is another example. The warning appears even if there are no calls to to
compiler_options() or compiler_version().

This bug basically makes the option -Wsurprising useless in combination with
iso_fortran_env.

test_mod.f90:
module test_mod
use iso_fortran_env
end module test_mod

test.f90:
use test_mod
end

>gcc -c test_mod.f90
>gfortran -c -Wsurprising test.f90
test.f90:1.12:

use test_mod
1
Warning: Type specified for intrinsic function 'compiler_options' at (1) is
ignored
test.f90:1.12:

use test_mod
1
Warning: Type specified for intrinsic function 'compiler_version' at (1) is
ignored


[Bug fortran/45823] Bogus warning for intrinsic module procedures

2011-05-12 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45823

--- Comment #2 from Tobias Burnus  2011-05-12 
10:35:23 UTC ---
(In reply to comment #1)
> This bug basically makes the option -Wsurprising useless in combination with
> iso_fortran_env.
Well, you can still use ONLY - which is a decent work around, unless you really
need the two functions.


Regarding the test case from comment 0: resolve_intrinsic is called twice -
once from resolve_symbol (which sets then ts.type) and then again for
resolve_function; the second call to resolve_intrinsic generates then the
warning.

The following patch should work. It prevents the warning but if one tries to
modify the type, one gets the normal module warning:

Error: Symbol 'compiler_options' at (1) already has basic type of CHARACTER


--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1454,7 +1454,7 @@ resolve_intrinsic (gfc_symbol *sym, locus *loc)
   if (isym)
 {
   if (sym->ts.type != BT_UNKNOWN && gfc_option.warn_surprising
- && !sym->attr.implicit_type)
+ && !sym->attr.implicit_type && !sym->from_intmod)
gfc_warning ("Type specified for intrinsic function '%s' at %L is"
  " ignored", sym->name, &sym->declared_at);