* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
@ 2004-08-14 7:53 ` pinskia at gcc dot gnu dot org
2004-08-14 7:55 ` pinskia at gcc dot gnu dot org
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-14 7:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-14 07:53 -------
Confirmed.
And here is the problem:
Note no & on the variable:
(int1[1 .. 15] * &)new_item.3
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-08-14 07:53:11
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
2004-08-14 7:53 ` [Bug fortran/16939] " pinskia at gcc dot gnu dot org
@ 2004-08-14 7:55 ` pinskia at gcc dot gnu dot org
2004-08-25 22:10 ` tobi at gcc dot gnu dot org
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-14 7:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-14 07:55 -------
Well I was wrong on say note no & on the variable, really it should be like:
*temp_ptr = new_item.3;
instead of what it is now:
temp_ptr = (int1[1 .. 15] * &)new_item.3;
because otherwise temp_ptr gets assigned in create and does not get passed back.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
2004-08-14 7:53 ` [Bug fortran/16939] " pinskia at gcc dot gnu dot org
2004-08-14 7:55 ` pinskia at gcc dot gnu dot org
@ 2004-08-25 22:10 ` tobi at gcc dot gnu dot org
2005-04-06 18:37 ` pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-08-25 22:10 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |17193
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (2 preceding siblings ...)
2004-08-25 22:10 ` tobi at gcc dot gnu dot org
@ 2005-04-06 18:37 ` pinskia at gcc dot gnu dot org
2005-04-06 19:26 ` paulthomas2 at wanadoo dot fr
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-06 18:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-06 18:37 -------
This looks to me (a non fortran person) a duplicate of bug 17192.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |17192
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (3 preceding siblings ...)
2005-04-06 18:37 ` pinskia at gcc dot gnu dot org
@ 2005-04-06 19:26 ` paulthomas2 at wanadoo dot fr
2005-04-06 19:31 ` paulthomas2 at wanadoo dot fr
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2005-04-06 19:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paulthomas2 at wanadoo dot fr 2005-04-06 19:26 -------
Subject: Re: Pointers not passed as subroutine arguments
----- Original Message -----
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: <paulthomas2@wanadoo.fr>
Sent: Wednesday, April 06, 2005 8:37 PM
Subject: [Bug fortran/16939] Pointers not passed as subroutine arguments
>
> ------- Additional Comments From pinskia at gcc dot gnu dot org
> 2005-04-06 18:37 -------
> This looks to me (a non fortran person) a duplicate of bug 17192.
>
> --
> What |Removed |Added
> ----------------------------------------------------------------------------
> BugsThisDependsOn| |17192
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (4 preceding siblings ...)
2005-04-06 19:26 ` paulthomas2 at wanadoo dot fr
@ 2005-04-06 19:31 ` paulthomas2 at wanadoo dot fr
2005-05-09 13:55 ` tobi at gcc dot gnu dot org
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2005-04-06 19:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paulthomas2 at wanadoo dot fr 2005-04-06 19:31 -------
Subject: Re: Pointers not passed as subroutine arguments
I think that it is,..... in principle. The examples are a bit strange
though.
Paul
----- Original Message -----
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: <paulthomas2@wanadoo.fr>
Sent: Wednesday, April 06, 2005 8:37 PM
Subject: [Bug fortran/16939] Pointers not passed as subroutine arguments
>
> ------- Additional Comments From pinskia at gcc dot gnu dot org
> 2005-04-06 18:37 -------
> This looks to me (a non fortran person) a duplicate of bug 17192.
>
> --
> What |Removed |Added
> ----------------------------------------------------------------------------
> BugsThisDependsOn| |17192
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (5 preceding siblings ...)
2005-04-06 19:31 ` paulthomas2 at wanadoo dot fr
@ 2005-05-09 13:55 ` tobi at gcc dot gnu dot org
2005-05-09 16:07 ` paulthomas2 at wanadoo dot fr
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-05-09 13:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobi at gcc dot gnu dot org 2005-05-09 13:40 -------
What is wrong is this from the .t02.original dump:
create (temp_ptr, _temp_ptr)
{
char[1:15] * new_item;
{
void * * ptr.0;
ptr.0 = (void * *) &new_item;
_gfortran_allocate (ptr.0, 15, 0);
}
_gfortran_copy_string (15, new_item, 14, " A NEW STRING ");
temp_ptr = (char[1:15] * &) new_item;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_gfortran_filename = "pr16939.f90";
_gfortran_line = 19;
_gfortran_ioparm.unit = 6;
_gfortran_ioparm.list_format = 1;
_gfortran_st_write ();
_gfortran_transfer_character (temp_ptr, 15);
_gfortran_st_write_done ();
goto __return_create;
__return_create:;
}
The underlined line should be
temp_ptr = new_item
unless I misread something. temp_ptr should point to the same character string
new_item points to. The underlined statement makes it point to new_item instead.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (6 preceding siblings ...)
2005-05-09 13:55 ` tobi at gcc dot gnu dot org
@ 2005-05-09 16:07 ` paulthomas2 at wanadoo dot fr
2005-05-09 16:08 ` paulthomas2 at wanadoo dot fr
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2005-05-09 16:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paulthomas2 at wanadoo dot fr 2005-05-09 16:06 -------
That's right Tobi
The patch that fixes this bug and regtests is:
Index: trans-expr.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/trans-expr.c,v
retrieving revision 1.42
diff -p -c -3 -r1.42 trans-expr.c
*** trans-expr.c 29 Apr 2005 15:31:33 -0000 1.42
--- trans-expr.c 9 May 2005 14:41:23 -0000
*************** gfc_conv_variable (gfc_se * se, gfc_expr
*** 360,365 ****
--- 360,372 ----
if (sym->attr.dummy
&& sym->ts.type != BT_CHARACTER
&& !sym->attr.dimension)
+ se->expr = gfc_build_indirect_ref (se->expr);
+
+ /*Dereference dummy args that are character pointers. */
+ if (sym->attr.dummy
+ && sym->attr.pointer
+ && sym->ts.type == BT_CHARACTER
+ && !sym->attr.dimension)
se->expr = gfc_build_indirect_ref (se->expr);
/* Dereference pointer variables. */
I will do an update, bootstrap and regtest tonight before submitting this to
the lists. It should be posted tonight.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (7 preceding siblings ...)
2005-05-09 16:07 ` paulthomas2 at wanadoo dot fr
@ 2005-05-09 16:08 ` paulthomas2 at wanadoo dot fr
2005-05-29 16:03 ` cvs-commit at gcc dot gnu dot org
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2005-05-09 16:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paulthomas2 at wanadoo dot fr 2005-05-09 16:08 -------
Subject: Re: Pointers not passed as subroutine arguments
The following fixes PR16939 and regtests. I'll do a full synchronisatio,
bootstrap and regtest before posting it on the lists:
Best regards
Paul
Index: trans-expr.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/trans-expr.c,v
retrieving revision 1.42
diff -p -c -3 -r1.42 trans-expr.c
*** trans-expr.c 29 Apr 2005 15:31:33 -0000 1.42
--- trans-expr.c 9 May 2005 14:41:23 -0000
*************** gfc_conv_variable (gfc_se * se, gfc_expr
*** 360,365 ****
--- 360,372 ----
if (sym->attr.dummy
&& sym->ts.type != BT_CHARACTER
&& !sym->attr.dimension)
+ se->expr = gfc_build_indirect_ref (se->expr);
+
+ /*Dereference dummy args that are character pointers. */
+ if (sym->attr.dummy
+ && sym->attr.pointer
+ && sym->ts.type == BT_CHARACTER
+ && !sym->attr.dimension)
se->expr = gfc_build_indirect_ref (se->expr);
/* Dereference pointer variables. */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (8 preceding siblings ...)
2005-05-09 16:08 ` paulthomas2 at wanadoo dot fr
@ 2005-05-29 16:03 ` cvs-commit at gcc dot gnu dot org
2005-06-05 8:59 ` cvs-commit at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-29 16:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-29 16:02 -------
Subject: Bug 16939
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pault@gcc.gnu.org 2005-05-29 16:02:11
Modified files:
gcc/fortran : trans-array.c trans-expr.c
Log message:
2005-05-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/16939
PR fortran/17192
PR fortran/17193
PR fortran/17202
PR fortran/18689
PR fortran/18890
PR fortran/21297
* fortran/trans-array.c (gfc_conv_resolve_dependencies): Add string
length to temp_ss for character pointer array assignments.
* fortran/trans-expr.c (gfc_conv_variable): Correct errors in
dereferencing of characters and character pointers.
* fortran/trans-expr.c (gfc_conv_function_call): Provide string
length as return argument for various kinds of handling of return.
Return a char[]* temporary for character pointer functions and
dereference the temporary upon return.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&r1=1.45&r2=1.46
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-expr.c.diff?cvsroot=gcc&r1=1.44&r2=1.45
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (9 preceding siblings ...)
2005-05-29 16:03 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-05 8:59 ` cvs-commit at gcc dot gnu dot org
2005-06-05 22:42 ` pault at gcc dot gnu dot org
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-05 8:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-06-05 08:59 -------
Subject: Bug 16939
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: pault@gcc.gnu.org 2005-06-05 08:59:18
Modified files:
gcc/fortran : ChangeLog trans-array.c trans-expr.c
Log message:
005-05-31 Paul Thomas <pault@gcc.gnu.org>
PR fortran/18109
PR fortran/18283
PR fortran/19107
PR fortran/16939
PR fortran/17192
PR fortran/17193
PR fortran/17202
PR fortran/18689
PR fortran/18890
* fortran/trans-array.c (gfc_conv_expr_descriptor): Obtain the
string length from the expression typespec character length value
and set temp_ss->stringlength and backend_decl. Obtain the
tree expression from gfc_conv_expr rather than gfc_conv_expr_val.
Dereference the expression to obtain the character.
* fortran/trans-array.c (gfc_conv_resolve_dependencies): Add string
length to temp_ss for character pointer array assignments.
* fortran/trans-expr.c (gfc_conv_component_ref): Remove the
dereference of scalar character pointer structure components.
* fortran/trans-expr.c (gfc_trans_subarray_assign): Obtain the
string length for the structure component from the component
expression.
* fortran/trans-expr.c (gfc_conv_variable): Correct errors in
dereferencing of characters and character pointers.
* fortran/trans-expr.c (gfc_conv_function_call): Provide string
length as return argument for various kinds of handling of return.
Return a char[]* temporary for character pointer functions and
dereference the temporary upon return.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.66&r2=1.335.2.67
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.39.2.3&r2=1.39.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-expr.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.38.2.4&r2=1.38.2.5
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (10 preceding siblings ...)
2005-06-05 8:59 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-05 22:42 ` pault at gcc dot gnu dot org
2005-06-05 22:43 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pault at gcc dot gnu dot org @ 2005-06-05 22:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pault at gcc dot gnu dot org 2005-06-05 22:42 -------
Fixed in 4.0 and 4.1
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (11 preceding siblings ...)
2005-06-05 22:42 ` pault at gcc dot gnu dot org
@ 2005-06-05 22:43 ` pault at gcc dot gnu dot org
2005-06-05 22:44 ` pault at gcc dot gnu dot org
2005-06-05 22:55 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: pault at gcc dot gnu dot org @ 2005-06-05 22:43 UTC (permalink / raw)
To: gcc-bugs
--
Bug 16939 depends on bug 17192, which changed state.
Bug 17192 Summary: Functions returning character pointer via argument are broken
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17192
What |Old Value |New Value
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (12 preceding siblings ...)
2005-06-05 22:43 ` pault at gcc dot gnu dot org
@ 2005-06-05 22:44 ` pault at gcc dot gnu dot org
2005-06-05 22:55 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: pault at gcc dot gnu dot org @ 2005-06-05 22:44 UTC (permalink / raw)
To: gcc-bugs
--
Bug 16939 depends on bug 17193, which changed state.
Bug 17193 Summary: [meta-bug] Pointer arguments not working correctly
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17193
What |Old Value |New Value
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/16939] Pointers not passed as subroutine arguments
2004-08-09 14:27 [Bug fortran/16939] New: Pointers not passed as subroutine arguments paulthomas2 at wanadoo dot fr
` (13 preceding siblings ...)
2005-06-05 22:44 ` pault at gcc dot gnu dot org
@ 2005-06-05 22:55 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 22:55 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16939
^ permalink raw reply [flat|nested] 16+ messages in thread