public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32801]  New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
@ 2007-07-17 23:58 sysmaint at contek dot com
  2007-07-18  5:44 ` [Bug fortran/32801] " burnus at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: sysmaint at contek dot com @ 2007-07-17 23:58 UTC (permalink / raw)
  To: gcc-bugs

The following program causes a fault in the compiler:
    c_loc_prob.f:0: internal compiler error: Segmentation fault: 11
This is the reduced program:

    PROGRAM c_loc_prob
      USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_LOC 
     !   USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR, C_LOC
    END PROGRAM c_loc_prob

Additional information:
  - Options for optimization and warnings seem to not affect the errot.
  - If C_PTR is declared prior to C_LOC (as in the comment), the compiler
    doesn't fault.
  - In the original programs (from which this example is extracted, the
    declaration of C_PTR prior to C_LOC causes the compiler to erroneously
    diagnose various other constructs

Workarounds:
  At least two workaounds for this problem work in the other (much larger)
  programs:
    - Avoid use of ONLY: qualifier to ISO_C_BINDING, e.g.,
        USE, INTRINSIC :: ISO_C_BINDING
    - Replace C_LOC with LOC at the invocation and C_PTR with C_LONG at the
      INTERFACE declaration.


-- 
           Summary: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg
                    fault
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sysmaint at contek dot com
 GCC build triplet: same
  GCC host triplet: gfortran - 386-portbld-freebsd6.2 - 4.3.0 20070713
                    (experimental
GCC target triplet: same


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
@ 2007-07-18  5:44 ` burnus at gcc dot gnu dot org
  2007-07-18 11:24 ` fxcoudert at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-18  5:44 UTC (permalink / raw)
  To: gcc-bugs



-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32630
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|same                        |
   GCC host triplet|gfortran - 386-portbld-     |
                   |freebsd6.2 - 4.3.0 20070713 |
                   |(experimental               |
 GCC target triplet|same                        |
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-18 05:44:38
               date|                            |
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
  2007-07-18  5:44 ` [Bug fortran/32801] " burnus at gcc dot gnu dot org
@ 2007-07-18 11:24 ` fxcoudert at gcc dot gnu dot org
  2007-07-18 20:19 ` crickett at lanl dot gov
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-18 11:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-07-18 11:24 -------
Backtrace on x86_64-linux:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000459311 in resolve_symbol (sym=0xf0bb90)
    at ../../../trunk3/gcc/fortran/resolve.c:7284
7284      if (sym->ts.type == BT_DERIVED && sym->ts.derived->components == NULL
(gdb) where
#0  0x0000000000459311 in resolve_symbol (sym=0xf0bb90)
    at ../../../trunk3/gcc/fortran/resolve.c:7284
#1  0x0000000000463d87 in traverse_ns (st=0xf09930, 
    func=0x458a90 <resolve_symbol>)
    at ../../../trunk3/gcc/fortran/symbol.c:2846
#2  0x0000000000455480 in resolve_types (ns=0xf0ae80)
    at ../../../trunk3/gcc/fortran/resolve.c:8330
#3  0x0000000000458a6d in gfc_resolve (ns=0xf0bb90)
    at ../../../trunk3/gcc/fortran/resolve.c:8409
#4  0x000000000044b528 in gfc_parse_file ()

(gdb) p sym->ts
$3 = {type = BT_DERIVED, kind = 0, derived = 0x0, cl = 0x0, is_c_interop = 0, 
  is_iso_c = 0, f90_type = BT_UNKNOWN}

sym->ts has type BT_DERIVED, but yet sym->ts.derived is NULL. Maybe this should
be set earlier, or maybe the test on (sym->ts.type == BT_DERIVED &&
sym->ts.derived->components == NULL) just needs changing into (sym->ts.type ==
BT_DERIVED && sym->ts.derived && sym->ts.derived->components == NULL).

Christopher, any idea if this sym node is correct?


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2007-07-18 05:44:38         |2007-07-18 11:24:34
               date|                            |


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
  2007-07-18  5:44 ` [Bug fortran/32801] " burnus at gcc dot gnu dot org
  2007-07-18 11:24 ` fxcoudert at gcc dot gnu dot org
@ 2007-07-18 20:19 ` crickett at lanl dot gov
  2007-07-18 21:15 ` patchapp at dberlin dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: crickett at lanl dot gov @ 2007-07-18 20:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from crickett at lanl dot gov  2007-07-18 20:18 -------
(In reply to comment #1)

> sym->ts has type BT_DERIVED, but yet sym->ts.derived is NULL. Maybe this should
> be set earlier, or maybe the test on (sym->ts.type == BT_DERIVED &&
> sym->ts.derived->components == NULL) just needs changing into (sym->ts.type ==
> BT_DERIVED && sym->ts.derived && sym->ts.derived->components == NULL).
> 
> Christopher, any idea if this sym node is correct?
> 

the sym node was incorrect.  there is a simple error in
generate_isocbinding_symbol that auto-generated c_funptr instead of the
necessary c_ptr.  


-- 


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
                   ` (2 preceding siblings ...)
  2007-07-18 20:19 ` crickett at lanl dot gov
@ 2007-07-18 21:15 ` patchapp at dberlin dot org
  2007-07-18 22:02 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2007-07-18 21:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2007-07-18 21:15 -------
Subject: Bug number PR 32801

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01559.html


-- 


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
                   ` (3 preceding siblings ...)
  2007-07-18 21:15 ` patchapp at dberlin dot org
@ 2007-07-18 22:02 ` burnus at gcc dot gnu dot org
  2007-07-18 22:06 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-18 22:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-07-18 22:02 -------
Subject: Bug 32801

Author: burnus
Date: Wed Jul 18 22:02:21 2007
New Revision: 126732

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126732
Log:
2007-07-18  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/32801
        * symbol.c (generate_isocbinding_symbol): Fix bug where
        ISOCBINDING_FUNPTR was generated for C_LOC instead of the needed
        ISOCBINDING_PTR.


2007-07-18  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/32801
        * gfortran.dg/pr32801.f03: New test case.


Added:
    trunk/gcc/testsuite/gfortran.dg/pr32801.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
                   ` (4 preceding siblings ...)
  2007-07-18 22:02 ` burnus at gcc dot gnu dot org
@ 2007-07-18 22:06 ` burnus at gcc dot gnu dot org
  2007-07-21 20:31 ` kargl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-18 22:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2007-07-18 22:06 -------
>  - In the original programs (from which this example is extracted, the
>    declaration of C_PTR prior to C_LOC causes the compiler to erroneously
>    diagnose various other constructs

The reported problem has been fixed. Could you test whether the other problems
persist or whether they have been fixed as well?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
                   ` (5 preceding siblings ...)
  2007-07-18 22:06 ` burnus at gcc dot gnu dot org
@ 2007-07-21 20:31 ` kargl at gcc dot gnu dot org
  2007-07-21 20:41 ` kargl at gcc dot gnu dot org
  2007-08-06  9:20 ` fxcoudert at gcc dot gnu dot org
  8 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-07-21 20:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from kargl at gcc dot gnu dot org  2007-07-21 20:31 -------
Subject: Bug 32801

Author: kargl
Date: Sat Jul 21 20:31:17 2007
New Revision: 126812

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126812
Log:
2007-07-21  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/32801
        * symbol.c (generate_isocbinding_symbol): Remove unnecessary
        conditional.

        PR fortran/32804
        * resolve.c (gfc_iso_c_func_interface): Reject assumed-shape and
        deferred-shape arrays as args to C_LOC.  Fix bug in testing
        character args to C_LOC.

2007-07-21  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/32804
        * gfortran.dg/c_loc_tests_9.f03: New test case.
        * gfortran.dg/c_loc_tests_10.f03: Ditto.


Added:
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_10.f03
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_9.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
                   ` (6 preceding siblings ...)
  2007-07-21 20:31 ` kargl at gcc dot gnu dot org
@ 2007-07-21 20:41 ` kargl at gcc dot gnu dot org
  2007-08-06  9:20 ` fxcoudert at gcc dot gnu dot org
  8 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-07-21 20:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from kargl at gcc dot gnu dot org  2007-07-21 20:41 -------
Douglas,

Is this problem fixed for you, now?


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org
             Status|NEW                         |WAITING


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


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

* [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault
  2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
                   ` (7 preceding siblings ...)
  2007-07-21 20:41 ` kargl at gcc dot gnu dot org
@ 2007-08-06  9:20 ` fxcoudert at gcc dot gnu dot org
  8 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-06  9:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from fxcoudert at gcc dot gnu dot org  2007-08-06 09:20 -------
Without any more news, let's consider this fixed. Douglas, if it so happens
that your bug wasn't fixed by the patch, please reopen this bug-report.


-- 

fxcoudert at gcc dot gnu dot org changed:

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


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


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

* Re: [Bug fortran/32801] USE of ISO_C_BINDING, ONLY: C_LOC  causes compiler seg fault
       [not found] <20070806092010.29220.qmail@sourceware.org>
@ 2007-08-09  0:50 ` Douglas Wells
  0 siblings, 0 replies; 11+ messages in thread
From: Douglas Wells @ 2007-08-09  0:50 UTC (permalink / raw)
  To: gcc-bugs


> 
> 
> ------- Comment #8 from fxcoudert at gcc dot gnu dot org  2007-08-06 09:20 -------
> Without any more news, let's consider this fixed. Douglas, if it so happens
> that your bug wasn't fixed by the patch, please reopen this bug-report.
> 
> 
> -- 
> 
> fxcoudert at gcc dot gnu dot org changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|WAITING                     |RESOLVED
>          Resolution|                            |FIXED
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32801
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.

I apologize for sending this message directly to gcc-bugs, but I
feel somewhat powerless.

I have replied by e-mail to each of the inquiries that was directed
to me to report that this problem has indeed been fixed (at least
when I copied the modified files into my source tree and rebuilt).
However, none of these replies has made it into the bug-report, I
have received no error messages about the replies, and it appears
that none of the gcc developers have received my replies.

I just tried to update the bug report via the bugzilla web interface,
but I didn't see any way to add a comment.  When I tried to add
an attachment (with the notion that I could omit the attachment),
the system complained about the lack of attachment -- and I didn't
want to add an empty or useless attachment.

Thank you for supporting gfortran.  Is there some web page that
provides more specific information about how to use bugzilla for
gcc? (I'll note that the page http://gcc.gnu.org/bugs.html addresses
the issue of what information should goes into the bug report
description, not how to operate bugzilla.)

Thanks, - dmw


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

end of thread, other threads:[~2007-08-09  0:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-17 23:58 [Bug fortran/32801] New: USE of ISO_C_BINDING, ONLY: C_LOC causes compiler seg fault sysmaint at contek dot com
2007-07-18  5:44 ` [Bug fortran/32801] " burnus at gcc dot gnu dot org
2007-07-18 11:24 ` fxcoudert at gcc dot gnu dot org
2007-07-18 20:19 ` crickett at lanl dot gov
2007-07-18 21:15 ` patchapp at dberlin dot org
2007-07-18 22:02 ` burnus at gcc dot gnu dot org
2007-07-18 22:06 ` burnus at gcc dot gnu dot org
2007-07-21 20:31 ` kargl at gcc dot gnu dot org
2007-07-21 20:41 ` kargl at gcc dot gnu dot org
2007-08-06  9:20 ` fxcoudert at gcc dot gnu dot org
     [not found] <20070806092010.29220.qmail@sourceware.org>
2007-08-09  0:50 ` Douglas Wells

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).