public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45823] New: Bogus warning for intrinsic module procedures
@ 2010-09-28 23:34 burnus at gcc dot gnu.org
  2011-05-12 11:53 ` [Bug fortran/45823] " burnus at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-09-28 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Bogus warning for intrinsic module procedures
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Follow up to PR 40569. The following program prints with -Wall:

use iso_Fortran_env
                   1
Warning: Type specified for intrinsic function 'compiler_options' at (1) is
ignored

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

For some reason, c_sizeof is not affected.


use iso_c_binding
use iso_Fortran_env
implicit none
intrinsic sin
real :: x = 3.4
print *, sin(x), c_sizeof(c_int), compiler_options(), compiler_version()
end


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

* [Bug fortran/45823] Bogus warning for intrinsic module procedures
  2010-09-28 23:34 [Bug fortran/45823] New: Bogus warning for intrinsic module procedures burnus at gcc dot gnu.org
@ 2011-05-12 11:53 ` burnus at gcc dot gnu.org
  2011-05-12 12:54 ` thenlich at users dot sourceforge.net
  2011-05-12 18:35 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-05-12 11:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 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);


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

* [Bug fortran/45823] Bogus warning for intrinsic module procedures
  2010-09-28 23:34 [Bug fortran/45823] New: Bogus warning for intrinsic module procedures burnus at gcc dot gnu.org
  2011-05-12 11:53 ` [Bug fortran/45823] " burnus at gcc dot gnu.org
@ 2011-05-12 12:54 ` thenlich at users dot sourceforge.net
  2011-05-12 18:35 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-05-12 12:54 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Henlich <thenlich at users dot sourceforge.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thenlich at users dot
                   |                            |sourceforge.net

--- Comment #1 from Thomas Henlich <thenlich at users dot sourceforge.net> 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


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

* [Bug fortran/45823] Bogus warning for intrinsic module procedures
  2010-09-28 23:34 [Bug fortran/45823] New: Bogus warning for intrinsic module procedures burnus at gcc dot gnu.org
  2011-05-12 11:53 ` [Bug fortran/45823] " burnus at gcc dot gnu.org
  2011-05-12 12:54 ` thenlich at users dot sourceforge.net
@ 2011-05-12 18:35 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-05-12 18:35 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 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  <burnus@net-b.de>

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

2011-05-12  Tobias Burnus  <burnus@net-b.de>

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


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

end of thread, other threads:[~2011-05-12 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-28 23:34 [Bug fortran/45823] New: Bogus warning for intrinsic module procedures burnus at gcc dot gnu.org
2011-05-12 11:53 ` [Bug fortran/45823] " burnus at gcc dot gnu.org
2011-05-12 12:54 ` thenlich at users dot sourceforge.net
2011-05-12 18:35 ` burnus at gcc dot gnu.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).