public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64474] New: transfer(c_null_ptr, ...) causes an internal error
@ 2015-01-02 15:14 arjen.markus895 at gmail dot com
  2015-01-02 15:28 ` [Bug fortran/64474] [4.8 Regression] " janus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: arjen.markus895 at gmail dot com @ 2015-01-02 15:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64474

            Bug ID: 64474
           Summary: transfer(c_null_ptr, ...) causes an internal error
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arjen.markus895 at gmail dot com

I needed to pass a null pointer from Fortran to C. One attempt to do so was via
code like this:

module myinterfaces
    use iso_c_binding
    implicit none

    interface
        subroutine croutine( array ) bind(c,name='croutine')
            real, dimension(*) :: array
        end subroutine
    end interface
contains

subroutine myroutine
    real, dimension(1) :: dummy
    call croutine( transfer(c_null_ptr, dummy) )
end subroutine myroutine

end module myinterfaces

This causes an internal error:

f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug fortran/64474] [4.8 Regression] transfer(c_null_ptr, ...) causes an internal error
  2015-01-02 15:14 [Bug fortran/64474] New: transfer(c_null_ptr, ...) causes an internal error arjen.markus895 at gmail dot com
@ 2015-01-02 15:28 ` janus at gcc dot gnu.org
  2015-01-02 22:06 ` arjen.markus895 at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2015-01-02 15:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64474

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-02
                 CC|                            |janus at gcc dot gnu.org
            Summary|transfer(c_null_ptr, ...)   |[4.8 Regression]
                   |causes an internal error    |transfer(c_null_ptr, ...)
                   |                            |causes an internal error
     Ever confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org ---
I see the ICE with 4.7.4 and 4.8.3, but it is gone with 4.9.1 and trunk.

Also there is no ICE in 4.6.4, which technically makes it a regression. If we
can identify the commit which fixed this in 4.9, it could be backported to 4.8.

Btw, 4.7 and earlier show the warning:

    subroutine croutine( array ) bind(c,name='croutine')
                              1
Warning: Variable 'array' at (1) is a parameter to the BIND(C) procedure
'croutine' but may not be C interoperable


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

* [Bug fortran/64474] [4.8 Regression] transfer(c_null_ptr, ...) causes an internal error
  2015-01-02 15:14 [Bug fortran/64474] New: transfer(c_null_ptr, ...) causes an internal error arjen.markus895 at gmail dot com
  2015-01-02 15:28 ` [Bug fortran/64474] [4.8 Regression] " janus at gcc dot gnu.org
@ 2015-01-02 22:06 ` arjen.markus895 at gmail dot com
  2015-01-09 11:31 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: arjen.markus895 at gmail dot com @ 2015-01-02 22:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64474

--- Comment #2 from Arjen Markus <arjen.markus895 at gmail dot com> ---
Hi Janus,

thanks for looking into this. Personally, I have no problem moving to
version 4.9. It's just that I ran into the problem.

Regards,

Arjen

2015-01-02 16:28 GMT+01:00 janus at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64474
>
> janus at gcc dot gnu.org changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>            Keywords|                            |ice-on-valid-code
>              Status|UNCONFIRMED                 |NEW
>    Last reconfirmed|                            |2015-01-02
>                  CC|                            |janus at gcc dot gnu.org
>             Summary|transfer(c_null_ptr, ...)   |[4.8 Regression]
>                    |causes an internal error    |transfer(c_null_ptr, ...)
>                    |                            |causes an internal error
>      Ever confirmed|0                           |1
>
> --- Comment #1 from janus at gcc dot gnu.org ---
> I see the ICE with 4.7.4 and 4.8.3, but it is gone with 4.9.1 and trunk.
>
> Also there is no ICE in 4.6.4, which technically makes it a regression. If we
> can identify the commit which fixed this in 4.9, it could be backported to 4.8.
>
> Btw, 4.7 and earlier show the warning:
>
>     subroutine croutine( array ) bind(c,name='croutine')
>                               1
> Warning: Variable 'array' at (1) is a parameter to the BIND(C) procedure
> 'croutine' but may not be C interoperable
>
> --
> You are receiving this mail because:
> You reported the bug.


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

* [Bug fortran/64474] [4.8 Regression] transfer(c_null_ptr, ...) causes an internal error
  2015-01-02 15:14 [Bug fortran/64474] New: transfer(c_null_ptr, ...) causes an internal error arjen.markus895 at gmail dot com
  2015-01-02 15:28 ` [Bug fortran/64474] [4.8 Regression] " janus at gcc dot gnu.org
  2015-01-02 22:06 ` arjen.markus895 at gmail dot com
@ 2015-01-09 11:31 ` rguenth at gcc dot gnu.org
  2015-01-23 19:25 ` dominiq at lps dot ens.fr
  2015-02-11 14:31 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-09 11:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64474

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.5


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

* [Bug fortran/64474] [4.8 Regression] transfer(c_null_ptr, ...) causes an internal error
  2015-01-02 15:14 [Bug fortran/64474] New: transfer(c_null_ptr, ...) causes an internal error arjen.markus895 at gmail dot com
                   ` (2 preceding siblings ...)
  2015-01-09 11:31 ` rguenth at gcc dot gnu.org
@ 2015-01-23 19:25 ` dominiq at lps dot ens.fr
  2015-02-11 14:31 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-01-23 19:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64474

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The ICE has been fixed between revisions r197010 (2013-03-23, ICE) and r197238
(2013-03-29, compile), likely the monster commit r197053 for a lot of PRs
(pr38536, ..., pr56378). AFAICR this commit is too invasive to be back ported
to 4.8. If there is no objection till Sunday, I'll close this PR as FIXED (4.9
and 5.0).


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

* [Bug fortran/64474] [4.8 Regression] transfer(c_null_ptr, ...) causes an internal error
  2015-01-02 15:14 [Bug fortran/64474] New: transfer(c_null_ptr, ...) causes an internal error arjen.markus895 at gmail dot com
                   ` (3 preceding siblings ...)
  2015-01-23 19:25 ` dominiq at lps dot ens.fr
@ 2015-02-11 14:31 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-02-11 14:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64474

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |burnus at gcc dot gnu.org
         Resolution|---                         |WONTFIX

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
WONTFIX.

I don't think we will fix this for 4.8 - especially as 4.9 and 5 are working.
If someone feels inclined to fix it, feel free to reopen.


(In reply to Arjen Markus from comment #0)
> I needed to pass a null pointer from Fortran to C. One attempt to do so was
> via code like this:

>         subroutine croutine( array ) bind(c,name='croutine')
>             real, dimension(*) :: array
>         end subroutine

How about using "OPTIONAL":
             real, dimension(*), OPTIONAL :: array  

>     call croutine( transfer(c_null_ptr, dummy) )

... and call it simply as "call croutine()"?


That's a Fortran 2008 feature, supported by GCC since 4.7.


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

end of thread, other threads:[~2015-02-11 14:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-02 15:14 [Bug fortran/64474] New: transfer(c_null_ptr, ...) causes an internal error arjen.markus895 at gmail dot com
2015-01-02 15:28 ` [Bug fortran/64474] [4.8 Regression] " janus at gcc dot gnu.org
2015-01-02 22:06 ` arjen.markus895 at gmail dot com
2015-01-09 11:31 ` rguenth at gcc dot gnu.org
2015-01-23 19:25 ` dominiq at lps dot ens.fr
2015-02-11 14:31 ` 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).