public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50974] New: ICE on invalid on function used as variable
@ 2011-11-03  5:19 abenson at caltech dot edu
  2011-11-03  8:25 ` [Bug fortran/50974] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: abenson at caltech dot edu @ 2011-11-03  5:19 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50974
           Summary: ICE on invalid on function used as variable
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: abenson@caltech.edu


Calling a function without the trailing () causes an ICE in gfortran 4.7.0
(r180805). For example:

module Test_Mod
  implicit none
  private

contains

  double precision function Func1()
    implicit none
    Func1=Func2
    return
  end function Func1

  double precision function Func2(arg1)
    implicit none
    double precision, intent(in) :: arg1
    Func2=arg1
  end function Func2

end module Test_Mod

$ gfortran -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.7/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.7/configure --prefix=/usr/local/gcc-4.7
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.7.0 20111102 (experimental) (GCC) 


$ gfortran -c test.F90 -o test.o
test.F90: In function ‘func1’:
test.F90:7:0: error: invalid types in conversion to floating point
real(kind=8)
real(kind=8) (*<T44f>) (real(kind=8) & restrict)
__result_func1.0 = (real(kind=8)) func2;

test.F90:7:0: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Adding () to the call to Func2 correctly results in an error being reported.

This bug seems similar to Bug 40678
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40678 which was present in 4.1, 4.2
and 4.3 but went away in 4.4 and 4.5 (not sure about 4.6).


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

* [Bug fortran/50974] ICE on invalid on function used as variable
  2011-11-03  5:19 [Bug fortran/50974] New: ICE on invalid on function used as variable abenson at caltech dot edu
@ 2011-11-03  8:25 ` rguenth at gcc dot gnu.org
  2011-11-03 14:56 ` [Bug fortran/50974] [4.7 regression] " kargl at gcc dot gnu.org
  2011-11-03 15:03 ` [Bug fortran/50974] " kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-03  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-03
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-03 08:25:22 UTC ---
It looks like the function pointer is casted to FP in gimple.  That's
not allowed (obviously).


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

* [Bug fortran/50974] [4.7 regression] ICE on invalid on function used as variable
  2011-11-03  5:19 [Bug fortran/50974] New: ICE on invalid on function used as variable abenson at caltech dot edu
  2011-11-03  8:25 ` [Bug fortran/50974] " rguenth at gcc dot gnu.org
@ 2011-11-03 14:56 ` kargl at gcc dot gnu.org
  2011-11-03 15:03 ` [Bug fortran/50974] " kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-11-03 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
      Known to work|                            |4.5.4, 4.6.3
            Summary|ICE on invalid on function  |[4.7 regression] ICE on
                   |used as variable            |invalid on function used as
                   |                            |variable
      Known to fail|                            |4.7.0

--- Comment #2 from kargl at gcc dot gnu.org 2011-11-03 14:55:53 UTC ---
Here's a reduced testcase.

module test_mod

  implicit none

  contains

  function func1()
    real func1
    func1 = func2
  end function func1

  function func2()
    real func2
    func2 = 1 
  end function func2

end module test_mod

Note, if func2 is moved above func1 in the file, then we get
the expected error.

foo.f90:16.17:

    func1 = func2
                 1
Error: Function 'func2' requires an argument list at (1)


Also, note that the code compiles with 4.5.4 and 4.6.3,
so this is a regression.


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

* [Bug fortran/50974] ICE on invalid on function used as variable
  2011-11-03  5:19 [Bug fortran/50974] New: ICE on invalid on function used as variable abenson at caltech dot edu
  2011-11-03  8:25 ` [Bug fortran/50974] " rguenth at gcc dot gnu.org
  2011-11-03 14:56 ` [Bug fortran/50974] [4.7 regression] " kargl at gcc dot gnu.org
@ 2011-11-03 15:03 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-11-03 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.5.4, 4.6.3                |
            Summary|[4.7 regression] ICE on     |ICE on invalid on function
                   |invalid on function used as |used as variable
                   |variable                    |

--- Comment #3 from kargl at gcc dot gnu.org 2011-11-03 15:01:39 UTC ---
(In reply to comment #2)

> Also, note that the code compiles with 4.5.4 and 4.6.3,
> so this is a regression.

Now that I think about the situation.  This isn't 
a regression per se.  With 4.5 and 4.6, the situation
is accepts-invalid. Removing regression in subj line
and updating 'Known to work' field.


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

end of thread, other threads:[~2011-11-03 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03  5:19 [Bug fortran/50974] New: ICE on invalid on function used as variable abenson at caltech dot edu
2011-11-03  8:25 ` [Bug fortran/50974] " rguenth at gcc dot gnu.org
2011-11-03 14:56 ` [Bug fortran/50974] [4.7 regression] " kargl at gcc dot gnu.org
2011-11-03 15:03 ` [Bug fortran/50974] " kargl 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).