public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32594]  New: ICE: bus error with attached code and June 28 MacOSX Intel binary)
@ 2007-07-02 18:49 awgreynolds at earthlink dot net
  2007-07-02 18:51 ` [Bug fortran/32594] " awgreynolds at earthlink dot net
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: awgreynolds at earthlink dot net @ 2007-07-02 18:49 UTC (permalink / raw)
  To: gcc-bugs

Originally thought was related to 31609 bug but may be new

gfortran -c utility.f9


-- 
           Summary: ICE: bus error with attached code and June 28 MacOSX
                    Intel binary)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: awgreynolds at earthlink dot net


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


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

* [Bug fortran/32594] ICE: bus error with attached code and June 28 MacOSX Intel binary)
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
@ 2007-07-02 18:51 ` awgreynolds at earthlink dot net
  2007-07-02 19:31 ` dfranke at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: awgreynolds at earthlink dot net @ 2007-07-02 18:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from awgreynolds at earthlink dot net  2007-07-02 18:51 -------
Created an attachment (id=13828)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13828&action=view)
source code that causes ICE: bus error

zip containing 2 include and 1 f90 file


-- 


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


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

* [Bug fortran/32594] ICE: bus error with attached code and June 28 MacOSX Intel binary)
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
  2007-07-02 18:51 ` [Bug fortran/32594] " awgreynolds at earthlink dot net
@ 2007-07-02 19:31 ` dfranke at gcc dot gnu dot org
  2007-07-04  7:47 ` [Bug fortran/32594] INDEX is not simplified, leads to ICE fxcoudert at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-02 19:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2007-07-02 19:31 -------
Simplified testcase and backtrace (4.3, 20070702):

function EvaluateMath(expr)
  character(*), intent(in) :: expr
  character(*), parameter  :: chrs='-+.0123456789eEdD'

  LOGICAL :: tmp
  tmp = (index(chrs(14:), "xxx") > 0)
end


Backtrace:

Program received signal SIGSEGV, Segmentation fault.
gfc_extract_int (expr=0x0, result=0xbfb25b84) at
../../../gcc/gcc/fortran/expr.c:252
252       if (expr->expr_type != EXPR_CONSTANT)
(gdb) bt
#0  gfc_extract_int (expr=0x0, result=0xbfb25b84) at
../../../gcc/gcc/fortran/expr.c:252
#1  0x08067087 in gfc_simplify_expr (p=0x8934270, type=0) at
../../../gcc/gcc/fortran/expr.c:1516
#2  0x080671a5 in gfc_simplify_expr (p=0x89340e0, type=0) at
../../../gcc/gcc/fortran/expr.c:1496
#3  0x080671d4 in gfc_simplify_expr (p=0x8934500, type=0) at
../../../gcc/gcc/fortran/expr.c:779
#4  0x0809da90 in resolve_operator (e=0x8934500) at
../../../gcc/gcc/fortran/resolve.c:2830
#5  0x0809a88c in gfc_resolve_expr (e=0x8934500) at
../../../gcc/gcc/fortran/resolve.c:3768
#6  0x0809ec7a in resolve_code (code=0x8934570, ns=0x8933208) at
../../../gcc/gcc/fortran/resolve.c:5649
#7  0x080a075c in resolve_codes (ns=0x8933208) at
../../../gcc/gcc/fortran/resolve.c:8298
#8  0x080a0793 in gfc_resolve (ns=0x8933208) at
../../../gcc/gcc/fortran/resolve.c:8317
#9  0x08092e10 in gfc_parse_file () at ../../../gcc/gcc/fortran/parse.c:3263
#10 0x080b7efd in gfc_be_parse_file (set_yydebug=0) at
../../../gcc/gcc/fortran/f95-lang.c:301
#11 0x08328ac8 in toplev_main (argc=2, argv=0xbfb26094) at
../../../gcc/gcc/toplev.c:1051
#12 0x080fec6f in main (argc=Cannot access memory at address 0x80000000
) at ../../../gcc/gcc/main.c:35


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.1.2 4.2.1 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-02 19:31:03
               date|                            |


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


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

* [Bug fortran/32594] INDEX is not simplified, leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
  2007-07-02 18:51 ` [Bug fortran/32594] " awgreynolds at earthlink dot net
  2007-07-02 19:31 ` dfranke at gcc dot gnu dot org
@ 2007-07-04  7:47 ` fxcoudert at gcc dot gnu dot org
  2007-07-04 14:36 ` fxcoudert at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-04  7:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2007-07-04 07:47 -------
I think it's due to the fact that there is no simplification done for INDEX (in
simplify.c).


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
   Last reconfirmed|2007-07-02 19:31:03         |2007-07-04 07:47:17
               date|                            |
            Summary|ICE: bus error with attached|INDEX is not simplified,
                   |code and June 28 MacOSX     |leads to ICE
                   |Intel binary)               |


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


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

* [Bug fortran/32594] INDEX is not simplified, leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
                   ` (2 preceding siblings ...)
  2007-07-04  7:47 ` [Bug fortran/32594] INDEX is not simplified, leads to ICE fxcoudert at gcc dot gnu dot org
@ 2007-07-04 14:36 ` fxcoudert at gcc dot gnu dot org
  2007-07-10 22:44 ` [Bug fortran/32594] substring simplification " fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-04 14:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-07-04 14:36 -------
Please forget comment #3. The reason for the ICE is that substring
simplification was written without taking into account the possibility of
foo(14:) or foo(:14), ie one of the substring bounds being implicit. The
following patch fixes it, I'm regtesting and will try to write a few more
testcases before submitting it for review:

Index: expr.c
===================================================================
--- expr.c      (revision 126249)
+++ expr.c      (working copy)
@@ -1503,9 +1503,19 @@ gfc_simplify_expr (gfc_expr *p, int type
          char *s;
          int start, end;

-         gfc_extract_int (p->ref->u.ss.start, &start);
-         start--;  /* Convert from one-based to zero-based.  */
-         gfc_extract_int (p->ref->u.ss.end, &end);
+         if (p->ref->u.ss.start)
+         {
+           gfc_extract_int (p->ref->u.ss.start, &start);
+           start--;  /* Convert from one-based to zero-based.  */
+         }
+         else
+           start = 0;
+
+         if (p->ref->u.ss.end)
+           gfc_extract_int (p->ref->u.ss.end, &end);
+         else
+           end = p->value.character.length - 1;
+
          s = gfc_getmem (end - start + 2);
          memcpy (s, p->value.character.string + start, end - start);
          s[end - start + 1] = '\0';  /* TODO: C-style string.  */


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
           Keywords|                            |patch
   Last reconfirmed|2007-07-04 07:47:17         |2007-07-04 14:36:19
               date|                            |


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


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

* [Bug fortran/32594] substring simplification leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
                   ` (3 preceding siblings ...)
  2007-07-04 14:36 ` fxcoudert at gcc dot gnu dot org
@ 2007-07-10 22:44 ` fxcoudert at gcc dot gnu dot org
  2007-08-12 20:15 ` fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-10 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-07-10 22:44 -------
It's a larger problem. The patch above avoids this ICE, but we have another one
when using substring references of type string(:). The following code, with
patched compiler, yields the other ICE:

  character(*), parameter  :: chrs = '-+.0123456789eEdD'
  character(*), parameter  :: expr = '-+.0123456789eEdD'
  print *, index(chrs(:), expr)
  print *, index(chrs(14:), expr)
  print *, index(chrs(:12), expr)
  print *, index(chrs, expr(:))
  print *, index(chrs, expr(1:))
  print *, index(chrs, expr(:1))

contains
  function foo(expr)
    character(*), intent(in) :: expr
    character(*), parameter  :: chrs = '-+.0123456789eEdD'
    integer :: foo

    foo = index(chrs(:), expr)
    foo = index(chrs(14:), expr)
    foo = index(chrs(:12), expr)
    foo = index(chrs, expr(:))
    foo = index(chrs, expr(1:))
    foo = index(chrs, expr(:1))
  end function foo
end

This is because expr->ref is NULL in that later case (there's a comment
somewhere to that effect), which is not dealt with later during translation.


-- 


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


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

* [Bug fortran/32594] substring simplification leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
                   ` (4 preceding siblings ...)
  2007-07-10 22:44 ` [Bug fortran/32594] substring simplification " fxcoudert at gcc dot gnu dot org
@ 2007-08-12 20:15 ` fxcoudert at gcc dot gnu dot org
  2007-08-13 23:49 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-12 20:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug fortran/32594] substring simplification leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
                   ` (5 preceding siblings ...)
  2007-08-12 20:15 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-13 23:49 ` fxcoudert at gcc dot gnu dot org
  2007-08-13 23:50 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-13 23:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-08-13 23:48 -------
A complete patch (for both original problem and a few other ones discovered
while preparing the testcase) was submitted here:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg00834.html


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |08/msg00834.html
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-07-04 14:36:19         |2007-08-13 23:48:53
               date|                            |


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


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

* [Bug fortran/32594] substring simplification leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
                   ` (6 preceding siblings ...)
  2007-08-13 23:49 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-13 23:50 ` patchapp at dberlin dot org
  2007-08-14 12:45 ` fxcoudert at gcc dot gnu dot org
  2007-08-14 12:47 ` fxcoudert at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2007-08-13 23:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2007-08-13 23:50 -------
Subject: Bug number PR32594

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-08/msg00834.html


-- 


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


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

* [Bug fortran/32594] substring simplification leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
                   ` (7 preceding siblings ...)
  2007-08-13 23:50 ` patchapp at dberlin dot org
@ 2007-08-14 12:45 ` fxcoudert at gcc dot gnu dot org
  2007-08-14 12:47 ` fxcoudert at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-14 12:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from fxcoudert at gcc dot gnu dot org  2007-08-14 12:44 -------
Subject: Bug 32594

Author: fxcoudert
Date: Tue Aug 14 12:44:19 2007
New Revision: 127478

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127478
Log:
        PR fortran/32594

        * trans-expr.c (gfc_conv_substring_expr): Only call
        gfc_conv_substring if expr->ref is not NULL.
        * expr.c (gfc_is_constant_expr): If e->ref is NULL, the substring
        expression might be a constant.
        (gfc_simplify_expr): Handle missing start and end, as well as
        missing ref.

        * gfortran.dg/substr_5.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/substr_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32594] substring simplification leads to ICE
  2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
                   ` (8 preceding siblings ...)
  2007-08-14 12:45 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-14 12:47 ` fxcoudert at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-14 12:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from fxcoudert at gcc dot gnu dot org  2007-08-14 12:47 -------
Fixed.


-- 

fxcoudert at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-08-14 12:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-02 18:49 [Bug fortran/32594] New: ICE: bus error with attached code and June 28 MacOSX Intel binary) awgreynolds at earthlink dot net
2007-07-02 18:51 ` [Bug fortran/32594] " awgreynolds at earthlink dot net
2007-07-02 19:31 ` dfranke at gcc dot gnu dot org
2007-07-04  7:47 ` [Bug fortran/32594] INDEX is not simplified, leads to ICE fxcoudert at gcc dot gnu dot org
2007-07-04 14:36 ` fxcoudert at gcc dot gnu dot org
2007-07-10 22:44 ` [Bug fortran/32594] substring simplification " fxcoudert at gcc dot gnu dot org
2007-08-12 20:15 ` fxcoudert at gcc dot gnu dot org
2007-08-13 23:49 ` fxcoudert at gcc dot gnu dot org
2007-08-13 23:50 ` patchapp at dberlin dot org
2007-08-14 12:45 ` fxcoudert at gcc dot gnu dot org
2007-08-14 12:47 ` fxcoudert 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).