public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40011]  New: Problems with -fwhole-file
@ 2009-05-03 19:53 dominiq at lps dot ens dot fr
  2009-05-04  9:10 ` [Bug fortran/40011] " pault at gcc dot gnu dot org
                   ` (71 more replies)
  0 siblings, 72 replies; 73+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-05-03 19:53 UTC (permalink / raw)
  To: gcc-bugs

Summary of the problems with -fwhole-file I have found so far.

>From http://gcc.gnu.org/ml/fortran/2009-03/msg00310.html:

--------------------------------------------------------------------------------

(1) From a first look the several "Segmentation fault" are coming from 
recursive functions, the simplest code being the following:

[ibook-dhum] f90/bug% cat recurs_test_1.f90

! { dg-do compile }
      RECURSIVE FUNCTION eval_args(q)  result (r)
      INTEGER NNODE 
      PARAMETER (NNODE  = 10) 

      TYPE NODE 
       SEQUENCE 
           INTEGER car 
           INTEGER cdr 
      END TYPE NODE 
      TYPE(NODE) heap(NNODE) 

      INTEGER r, q 
           r = eval_args(heap(q)%cdr) 
      END FUNCTION eval_args 

[ibook-dhum] f90/bug% gfc -c -fwhole-file recurs_test_1.f90
gfc: Internal error: Segmentation fault (program f951)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

--------------------------------------------------------------------------------

(2) I have also an ICE (already reported in PR26227 
http://gcc.gnu.org/ml/gcc-bugs/2009-03/msg02321.html) for 

[ibook-dhum] f90/bug% cat arr_fun.f90

function test(n)
real, dimension(2) :: test
integer            :: n
test = n
! print *, test
return
end function test
program arr
real, dimension(2) :: res
res = test(2)
print *, res
end program

[ibook-dhum] f90/bug% gfc -fwhole-file arr_fun.f90
arr_fun.f90: In function 'arr':
arr_fun.f90:8: internal compiler error: in fold_convert, at fold-const.c:2547
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

--------------------------------------------------------------------------------

(3) And I think the following are false positives:

[ibook-dhum] f90/bug% cat specifics_red_4.f90

subroutine test_d(fn, val, res)
  double precision fn
  double precision val, res

  print *, fn(val), res
end subroutine

subroutine test_c(fn, val, res)
  complex fn
  complex val, res

  print *, fn(val), res
end subroutine

program specifics

  intrinsic dcos
  intrinsic dcosh
  intrinsic dexp

  intrinsic conjg

  call test_d (dcos, 1d0, dcos(1d0))
  call test_d (dcosh, 1d0, dcosh(1d0))
  call test_d (dexp, 1d0, dexp(1d0))

  call test_c (conjg, (1.0,1.0) , conjg((1.0,1.0)))

end program

[ibook-dhum] f90/bug% gfc -fwhole-file specifics_red_4.f90
specifics_red_4.f90:25.15:

  call test_d (dcos, 1d0, dcos(1d0))
               1
Error: Type/rank mismatch in argument 'fn' at (1)
specifics_red_4.f90:26.15:

  call test_d (dcosh, 1d0, dcosh(1d0))
               1
Error: Type/rank mismatch in argument 'fn' at (1)
specifics_red_4.f90:27.15:

  call test_d (dexp, 1d0, dexp(1d0))
               1
Error: Type/rank mismatch in argument 'fn' at (1)
specifics_red_4.f90:29.15:

  call test_c (conjg, (1.0,1.0) , conjg((1.0,1.0)))
               1
Error: Type/rank mismatch in argument 'fn' at (1)

--------------------------------------------------------------------------------

>From http://gcc.gnu.org/ml/fortran/2009-03/msg00316.html

Your patch fixes some Segmentation faults (a couple), but not this one:

! { dg-do compile }
program test
interface
  function bad_stuff(n)
    integer :: bad_stuff (2)
    integer :: n(2)
  end function bad_stuff
   recursive function rec_stuff(n) result (tmp)
    integer :: n(2), tmp(2)
  end function rec_stuff
end interface
   integer :: res(2)
  res = bad_stuff((/-19,-30/))

end program test

  recursive function bad_stuff(n)
    integer :: bad_stuff (2)
    integer :: n(2), tmp(2), ent = 0, sent = 0
    save ent, sent
    ent = -1
   entry rec_stuff(n) result (tmp)
    if (ent == -1) then
      sent = ent
      ent = 0
    end if
    ent = ent + 1
    tmp = 1
    if(maxval (n) < 5) then
      tmp = tmp + rec_stuff (n+1)
      ent = ent - 1
    endif
    if (ent == 1) then
      if (sent == -1) then
        bad_stuff = tmp + bad_stuff (1)
      end if
      ent = 0
      sent = 0
    end if
  end function bad_stuff

--------------------------------------------------------------------------------

>From http://gcc.gnu.org/ml/fortran/2009-03/msg00317.html

A simpler test:

recursive function fac(i) result (res)
  integer :: i, j, k, res
  k = 1
  goto 100
entry bifac(i,j) result (res)
  k = j
100 continue
  if (i < k) then
    res = 1
  else
    res = i * bifac(i-k,k)
  end if
end function

program test
  external fac
  external bifac
  integer :: fac, bifac
  print *, fac(5)
  print *, bifac(5,2)
  print*, fac(6)
  print *, bifac(6,2)
  print*, fac(0)
  print *, bifac(1,2)
end program test

--------------------------------------------------------------------------------

>From http://gcc.gnu.org/ml/fortran/2009-04/msg00031.html
some ICEs on the polyhedron test suite (see also pr39896):

[ibook-dhum] lin/test% gfc -fwhole-file aermod.f90
f951: internal compiler error: Bus error
[ibook-dhum] lin/test% gfc -fwhole-file air.f90
f951: internal compiler error: Bus error
[ibook-dhum] lin/test% gfc -O0 -fwhole-file gas_dyn.f90
[ibook-dhum] lin/test% gfc -O1 -fwhole-file gas_dyn.f90
gas_dyn.f90: In function 'eos':
gas_dyn.f90:360: internal compiler error: Bus error
[ibook-dhum] lin/test% gfc -O2 -fwhole-file gas_dyn.f90
gas_dyn.f90: In function 'readin':
gas_dyn.f90:1572: internal compiler error: Bus error
[ibook-dhum] lin/test% gfc -O3 -fwhole-file gas_dyn.f90
gas_dyn.f90: In function 'nozzle':
gas_dyn.f90:896: internal compiler error: Bus error

Note that for gas_dyn.f90, there is no ICE at -O0 while
with nonzero optimization, the ICEs occur in different
places.


-- 
           Summary: Problems with -fwhole-file
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr


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


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

end of thread, other threads:[~2020-06-14 15:24 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-40011-4@http.gcc.gnu.org/bugzilla/>
2020-06-14 15:24 ` [Bug fortran/40011] Problems with -fwhole-file tkoenig at gcc dot gnu.org
2009-05-03 19:53 [Bug fortran/40011] New: " dominiq at lps dot ens dot fr
2009-05-04  9:10 ` [Bug fortran/40011] " pault at gcc dot gnu dot org
2009-05-04  9:29 ` pault at gcc dot gnu dot org
2009-05-04  9:31 ` pault at gcc dot gnu dot org
2009-05-04 17:55 ` dominiq at lps dot ens dot fr
2009-05-04 21:52 ` dominiq at lps dot ens dot fr
2009-05-04 22:20 ` dominiq at lps dot ens dot fr
2009-05-04 22:44 ` dominiq at lps dot ens dot fr
2009-05-05  4:18 ` jv244 at cam dot ac dot uk
2009-05-05  7:05 ` dominiq at lps dot ens dot fr
2009-05-05  7:06 ` dominiq at lps dot ens dot fr
2009-05-05 11:33 ` dominiq at lps dot ens dot fr
2009-05-05 15:57 ` dominiq at lps dot ens dot fr
2009-05-05 18:12 ` pault at gcc dot gnu dot org
2009-05-05 19:29 ` jv244 at cam dot ac dot uk
2009-05-07 18:00 ` dfranke at gcc dot gnu dot org
2009-05-07 18:34 ` dfranke at gcc dot gnu dot org
2009-05-08 14:09 ` dominiq at lps dot ens dot fr
2009-05-17  5:12 ` jv244 at cam dot ac dot uk
2009-05-22 13:40 ` pault at gcc dot gnu dot org
2009-05-25  6:13 ` jv244 at cam dot ac dot uk
2009-05-27 13:03 ` burnus at gcc dot gnu dot org
2009-05-27 14:05 ` dominiq at lps dot ens dot fr
2009-05-27 17:52 ` jv244 at cam dot ac dot uk
2009-05-29 15:34 ` pault at gcc dot gnu dot org
2009-05-29 16:34 ` jv244 at cam dot ac dot uk
2009-05-29 18:42 ` burnus at gcc dot gnu dot org
2009-05-30  8:27 ` pault at gcc dot gnu dot org
2009-06-01 18:01 ` pault at gcc dot gnu dot org
2009-06-01 19:34 ` jv244 at cam dot ac dot uk
2009-06-01 19:43 ` jv244 at cam dot ac dot uk
2009-06-02  9:29 ` dominiq at lps dot ens dot fr
2009-06-02 12:32 ` dominiq at lps dot ens dot fr
2009-06-14 16:58 ` rguenth at gcc dot gnu dot org
2009-07-24  5:39 ` jv244 at cam dot ac dot uk
2009-07-24  5:48 ` jv244 at cam dot ac dot uk
2009-07-24 10:25 ` rguenth at gcc dot gnu dot org
2009-07-24 10:28 ` rguenth at gcc dot gnu dot org
2009-07-24 10:57 ` rguenth at gcc dot gnu dot org
2009-07-24 11:29 ` jv244 at cam dot ac dot uk
2009-07-25 16:53 ` jv244 at cam dot ac dot uk
2009-07-26 21:23 ` rguenth at gcc dot gnu dot org
2009-07-28  7:37 ` jv244 at cam dot ac dot uk
2009-08-01 13:45 ` pault at gcc dot gnu dot org
2009-08-03 10:12 ` jv244 at cam dot ac dot uk
2009-08-26  9:24 ` jv244 at cam dot ac dot uk
2009-08-26  9:35 ` rguenther at suse dot de
2009-08-26 10:32 ` dominiq at lps dot ens dot fr
2009-08-26 10:34 ` dominiq at lps dot ens dot fr
2009-08-26 10:36 ` dominiq at lps dot ens dot fr
2009-10-11 12:46 ` jv244 at cam dot ac dot uk
2009-12-09 11:51 ` jv244 at cam dot ac dot uk
2009-12-09 11:52 ` rguenther at suse dot de
2010-05-03 10:57 ` jv244 at cam dot ac dot uk
2010-05-03 19:24 ` jvdelisle at gcc dot gnu dot org
2010-05-26  5:11 ` pault at gcc dot gnu dot org
2010-05-26 13:13 ` jv244 at cam dot ac dot uk
2010-05-26 14:53 ` dominiq at lps dot ens dot fr
2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
2010-07-23 22:16 ` jv244 at cam dot ac dot uk
2010-07-23 22:55 ` jv244 at cam dot ac dot uk
2010-07-24  8:24 ` jv244 at cam dot ac dot uk
2010-07-24 11:11 ` jv244 at cam dot ac dot uk
2010-07-24 11:14 ` jv244 at cam dot ac dot uk
2010-07-24 11:31 ` burnus at gcc dot gnu dot org
2010-07-24 13:08 ` burnus at gcc dot gnu dot org
2010-07-24 13:46 ` rguenther at suse dot de
2010-07-24 14:08 ` burnus at gcc dot gnu dot org
2010-07-24 16:32 ` burnus at gcc dot gnu dot org
2010-07-25  1:21 ` jvdelisle at gcc dot gnu dot org
2010-07-25 10:11 ` burnus at gcc dot gnu dot org
2010-07-26  9:53 ` burnus at gcc dot gnu dot org
2010-07-26 13:15 ` burnus at gcc dot gnu dot 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).