public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37974]  New: gfortran runtime segmentation fault
@ 2008-10-31  2:07 deji_aking at yahoo dot ca
  2008-10-31  2:21 ` [Bug fortran/37974] " kargl at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: deji_aking at yahoo dot ca @ 2008-10-31  2:07 UTC (permalink / raw)
  To: gcc-bugs

Using Gfortran, I'm getting a segmentation fault from running a code which
reduces to the following;
...
   PROGRAM seg_main
   INTEGER :: ip
   real :: sig

        ip = 26314400
        call seg_sub(ip, sig, 1)
        write(*,*) 'sig is', sig
   END PROGRAM

   SUBROUTINE seg_sub(ip, p, kind0)

      implicit none
      integer ip, kind0
      real p

      kind0 = 2 - 1
      p = ip

      return
   END SUBROUTINE
...
I'm not sure if the code violates some fortran standards, although it seems
valid to me. But I think gfortran should give some warning or error messages
instead of just segfaulting. The code works fine with pgf90 on Linux and xlf on
AIX, but similarly segfault with ifort on Linux.


-- 
           Summary: gfortran runtime segmentation fault
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: deji_aking at yahoo dot ca


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


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

* [Bug fortran/37974] gfortran runtime segmentation fault
  2008-10-31  2:07 [Bug fortran/37974] New: gfortran runtime segmentation fault deji_aking at yahoo dot ca
@ 2008-10-31  2:21 ` kargl at gcc dot gnu dot org
  2008-10-31  3:33 ` deji_aking at yahoo dot ca
  2008-10-31  3:41 ` kargl at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-10-31  2:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2008-10-31 02:19 -------
        call seg_sub(ip, sig, 1)

Is that last argument a literal constant, name 'one'?
Or is it the letter 'ell'?

Either way it is impossible to reliable detect that
a user writes code that either tries to change the
value of a literal constant or uses an unitialized
variable.


-- 

kargl at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/37974] gfortran runtime segmentation fault
  2008-10-31  2:07 [Bug fortran/37974] New: gfortran runtime segmentation fault deji_aking at yahoo dot ca
  2008-10-31  2:21 ` [Bug fortran/37974] " kargl at gcc dot gnu dot org
@ 2008-10-31  3:33 ` deji_aking at yahoo dot ca
  2008-10-31  3:41 ` kargl at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: deji_aking at yahoo dot ca @ 2008-10-31  3:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from deji_aking at yahoo dot ca  2008-10-31 03:31 -------
(In reply to comment #1)
>         call seg_sub(ip, sig, 1)
> 
> Is that last argument a literal constant, name 'one'?
> Or is it the letter 'ell'?
> 
It is a literal constant 'one'. What really bugs me is why does it segfault at
all.
Thanks.

> Either way it is impossible to reliable detect that
> a user writes code that either tries to change the
> value of a literal constant or uses an unitialized
> variable.
> 


-- 


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


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

* [Bug fortran/37974] gfortran runtime segmentation fault
  2008-10-31  2:07 [Bug fortran/37974] New: gfortran runtime segmentation fault deji_aking at yahoo dot ca
  2008-10-31  2:21 ` [Bug fortran/37974] " kargl at gcc dot gnu dot org
  2008-10-31  3:33 ` deji_aking at yahoo dot ca
@ 2008-10-31  3:41 ` kargl at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-10-31  3:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kargl at gcc dot gnu dot org  2008-10-31 03:39 -------
(In reply to comment #2)
> (In reply to comment #1)
> >         call seg_sub(ip, sig, 1)
> > 
> > Is that last argument a literal constant, name 'one'?
> > Or is it the letter 'ell'?
> > 
> It is a literal constant 'one'. What really bugs me is why does it segfault at
> all.
> Thanks.

It segfaults because the constant 1 is in read-only memory.


-- 


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


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

end of thread, other threads:[~2008-10-31  3:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-31  2:07 [Bug fortran/37974] New: gfortran runtime segmentation fault deji_aking at yahoo dot ca
2008-10-31  2:21 ` [Bug fortran/37974] " kargl at gcc dot gnu dot org
2008-10-31  3:33 ` deji_aking at yahoo dot ca
2008-10-31  3:41 ` kargl 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).