public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40847]  New: [4.5 Regression] segfault & bogus warning
@ 2009-07-24 17:37 jv244 at cam dot ac dot uk
  2009-07-24 17:38 ` [Bug fortran/40847] [4.3/4.4/4.5 " jv244 at cam dot ac dot uk
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-07-24 17:37 UTC (permalink / raw)
  To: gcc-bugs

this should be an OK program, but gives a strange warning, and segfaults at run
time. 4.1.2 works fine.

program test_elemental

print *,'Transfer size:',transfer_size((/0.,0./),(/'a','b'/))

contains

   elemental function transfer_size (source, mold)
     real, intent(in)         :: source
     character(*), intent(in) :: mold
     integer                  :: transfer_size
     transfer_size = SIZE(TRANSFER(source, (/mold/)))
     return
   end function transfer_size

end program test_elemental


-- 
           Summary: [4.5 Regression] segfault & bogus warning
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


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


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
@ 2009-07-24 17:38 ` jv244 at cam dot ac dot uk
  2009-07-25 17:00 ` fxcoudert at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-07-24 17:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

jv244 at cam dot ac dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
      Known to fail|                            |4.4.1 4.5.0 4.3.3
      Known to work|                            |4.1.2
            Summary|[4.5 Regression] segfault & |[4.3/4.4/4.5 Regression]
                   |bogus warning               |segfault & bogus warning
   Target Milestone|---                         |4.3.5


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


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
  2009-07-24 17:38 ` [Bug fortran/40847] [4.3/4.4/4.5 " jv244 at cam dot ac dot uk
@ 2009-07-25 17:00 ` fxcoudert at gcc dot gnu dot org
  2009-07-27 10:08 ` burnus at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-07-25 17:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2009-07-25 16:59 -------
Reduced testcase:

  subroutine transfer_size (source, mold)
    real :: source 
    character(*) :: mold
    print *, ichar(transfer(source, (/mold/)))
  end subroutine

(can then be tested at runtime with "call transfer_size(exp(1.),'a')").


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-25 16:59:55
               date|                            |


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


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
  2009-07-24 17:38 ` [Bug fortran/40847] [4.3/4.4/4.5 " jv244 at cam dot ac dot uk
  2009-07-25 17:00 ` fxcoudert at gcc dot gnu dot org
@ 2009-07-27 10:08 ` burnus at gcc dot gnu dot org
  2009-07-27 12:57 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-07-27 10:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-07-27 10:08 -------
The following looks wrong:

gfc_resolve_transfer (gfc_expr *f, gfc_expr *source ATTRIBUTE_UNUSED,
                      gfc_expr *mold, gfc_expr *size)
[...]
  if (mold->ts.type == BT_CHARACTER && !mold->ts.cl->length
        && !(mold->expr_type == EXPR_VARIABLE
             && mold->symtree->n.sym->attr.dummy))
    mold->ts.cl->length = gfc_int_expr (mold->value.character.length);

For the testcase:
  mold->ts.type == BT_CHARACTER
  mold->ts.cl->length == NULL
  mold->expr_type == EXPR_VARIABLE
  mold->symtree == NULL  (!)
and
  mold->value.character.length == 19532032


-- 


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


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2009-07-27 10:08 ` burnus at gcc dot gnu dot org
@ 2009-07-27 12:57 ` burnus at gcc dot gnu dot org
  2009-07-27 13:20 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-07-27 12:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2009-07-27 12:57 -------
The real issue is that mold->expr_type is EXPR_VARIABLE and not EXPR_ARRAY. In
gfc_simplify_transfer everything is fine: mold->expr_type is EXPR_ARRAY but in
gfc_resolve_transfer it is already wrong. Must go wrong somewhere during
resolution ...


-- 

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=40847


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2009-07-27 12:57 ` burnus at gcc dot gnu dot org
@ 2009-07-27 13:20 ` rguenth at gcc dot gnu dot org
  2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-27 13:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|4.3.5                       |4.3.4


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


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2009-07-27 13:20 ` rguenth at gcc dot gnu dot org
@ 2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
  2009-08-05 14:47 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-08-04 12:30 -------
GCC 4.3.4 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.4                       |4.3.5


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


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (5 preceding siblings ...)
  2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
@ 2009-08-05 14:47 ` pault at gcc dot gnu dot org
  2009-08-05 16:10 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-08-05 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2009-08-05 14:47 -------
Created an attachment (id=18305)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18305&action=view)
A provisional patch for the PR

(In reply to comment #3)
> The real issue is that mold->expr_type is EXPR_VARIABLE and not EXPR_ARRAY. In
> gfc_simplify_transfer everything is fine: mold->expr_type is EXPR_ARRAY but in
> gfc_resolve_transfer it is already wrong. Must go wrong somewhere during
> resolution ...
> 

No, this is not the problem.  The fault is that the mold character length is
being incorrectly set in gfc_resolve_transfer.

The patch is regtesting.  If there are any FAILS it will be a matter of
correcting the condition.

Cheers

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/40847] [4.3/4.4/4.5 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (6 preceding siblings ...)
  2009-08-05 14:47 ` pault at gcc dot gnu dot org
@ 2009-08-05 16:10 ` pault at gcc dot gnu dot org
  2009-08-16 20:05 ` [Bug fortran/40847] [4.3/4.4 " pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-08-05 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2009-08-05 16:10 -------
Subject: Bug 40847

Author: pault
Date: Wed Aug  5 16:10:19 2009
New Revision: 150493

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150493
Log:
2009-08-05  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/40847
        * iresolve.c (gfc_resolve_transfer): Correct error in 'mold'
        character length for case where length expresson is NULL.

2009-08-05  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/40847
        * gfortran.dg/transfer_resolve_1.f90 : New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/transfer_resolve_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/40847] [4.3/4.4 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (7 preceding siblings ...)
  2009-08-05 16:10 ` pault at gcc dot gnu dot org
@ 2009-08-16 20:05 ` pault at gcc dot gnu dot org
  2009-08-16 21:02 ` [Bug fortran/40847] [4.3 " pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-08-16 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2009-08-16 20:04 -------
Subject: Bug 40847

Author: pault
Date: Sun Aug 16 20:04:40 2009
New Revision: 150810

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150810
Log:
2009-08-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/40847
        * iresolve.c (gfc_resolve_transfer): Correct error in 'mold'
        character length for case where length expresson is NULL.

2009-08-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/40847
        * gfortran.dg/transfer_resolve_1.f90 : New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/transfer_resolve_1.f90
Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/iresolve.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/40847] [4.3 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (9 preceding siblings ...)
  2009-08-16 21:02 ` [Bug fortran/40847] [4.3 " pault at gcc dot gnu dot org
@ 2009-08-16 21:02 ` pault at gcc dot gnu dot org
  2009-08-16 21:03 ` pault at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-08-16 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2009-08-16 21:02 -------
Fixed on trunk, 4.4 and 4.3.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |SUSPENDED


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


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

* [Bug fortran/40847] [4.3 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (8 preceding siblings ...)
  2009-08-16 20:05 ` [Bug fortran/40847] [4.3/4.4 " pault at gcc dot gnu dot org
@ 2009-08-16 21:02 ` pault at gcc dot gnu dot org
  2009-08-16 21:02 ` pault at gcc dot gnu dot org
  2009-08-16 21:03 ` pault at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-08-16 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2009-08-16 21:02 -------
Subject: Bug 40847

Author: pault
Date: Sun Aug 16 21:01:50 2009
New Revision: 150815

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150815
Log:
2009-08-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/40847
        * iresolve.c (gfc_resolve_transfer): Correct error in 'mold'
        character length for case where length expresson is NULL.

2009-08-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/40847
        * gfortran.dg/transfer_resolve_1.f90 : New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/transfer_resolve_1.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/iresolve.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/40847] [4.3 Regression] segfault & bogus warning
  2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
                   ` (10 preceding siblings ...)
  2009-08-16 21:02 ` pault at gcc dot gnu dot org
@ 2009-08-16 21:03 ` pault at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-08-16 21:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2009-08-16 21:03 -------
I missed 'fixed' !


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-08-16 21:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-24 17:37 [Bug fortran/40847] New: [4.5 Regression] segfault & bogus warning jv244 at cam dot ac dot uk
2009-07-24 17:38 ` [Bug fortran/40847] [4.3/4.4/4.5 " jv244 at cam dot ac dot uk
2009-07-25 17:00 ` fxcoudert at gcc dot gnu dot org
2009-07-27 10:08 ` burnus at gcc dot gnu dot org
2009-07-27 12:57 ` burnus at gcc dot gnu dot org
2009-07-27 13:20 ` rguenth at gcc dot gnu dot org
2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
2009-08-05 14:47 ` pault at gcc dot gnu dot org
2009-08-05 16:10 ` pault at gcc dot gnu dot org
2009-08-16 20:05 ` [Bug fortran/40847] [4.3/4.4 " pault at gcc dot gnu dot org
2009-08-16 21:02 ` [Bug fortran/40847] [4.3 " pault at gcc dot gnu dot org
2009-08-16 21:02 ` pault at gcc dot gnu dot org
2009-08-16 21:03 ` pault 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).