* [Bug fortran/50718] [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer
2011-10-13 17:28 [Bug fortran/50718] New: [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer burnus at gcc dot gnu.org
@ 2011-10-13 18:37 ` burnus at gcc dot gnu.org
2011-10-13 18:46 ` burnus at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-13 18:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50718
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.6.2
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-13 18:36:44 UTC ---
The backtrace above is bogus. The actual issue is at gfc_conv_procedure_call
for:
cond = fold_build2_loc (input_location, EQ_EXPR,
boolean_type_node, parmse.expr,
fold_convert (TREE_TYPE (parmse.expr),
null_pointer_node));
The problem is that the formal argument uses VALUE. Hence, the actual argument
is passed by value and it not an address expression.
Hence, the test "if (*actual == NULL)" does not make sense - one would need to
use "if (actual == NULL)" - hence, the "*" needs to be stripped away before
the comparison.
Simplified test case:
type t
integer :: p
end type t
interface
subroutine sub (x)
import t
type(t), value :: x
end subroutine
end interface
type(t), pointer :: y
call sub(y)
end
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50718] [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer
2011-10-13 17:28 [Bug fortran/50718] New: [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer burnus at gcc dot gnu.org
2011-10-13 18:37 ` [Bug fortran/50718] " burnus at gcc dot gnu.org
@ 2011-10-13 18:46 ` burnus at gcc dot gnu.org
2011-10-13 22:25 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-13 18:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50718
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-13 18:46:33 UTC ---
Untested draft patch:
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -3344,2 +3344,4 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{
+ tree arg;
+
if (attr.allocatable
@@ -3359,6 +3361,12 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
+ arg = parmse.expr;
+
+ /* If the argument is passed by value, we need to strip the
+ INDIRECT_REF. */
+ if (!POINTER_TYPE_P (TREE_TYPE (parmse.expr)))
+ arg = gfc_build_addr_expr (NULL_TREE, arg);
cond = fold_build2_loc (input_location, EQ_EXPR,
- boolean_type_node, parmse.expr,
- fold_convert (TREE_TYPE (parmse.expr),
+ boolean_type_node, arg
+ fold_convert (TREE_TYPE (arg),
null_pointer_node));
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50718] [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer
2011-10-13 17:28 [Bug fortran/50718] New: [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer burnus at gcc dot gnu.org
2011-10-13 18:37 ` [Bug fortran/50718] " burnus at gcc dot gnu.org
2011-10-13 18:46 ` burnus at gcc dot gnu.org
@ 2011-10-13 22:25 ` burnus at gcc dot gnu.org
2011-10-14 15:10 ` burnus at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-13 22:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50718
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-10-13
AssignedTo|unassigned at gcc dot |burnus at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-13 22:25:01 UTC ---
MINE. The patch in comment 2 (with a comma added after "arg") compiles and
fixes the issue in comment 1 and the original program.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50718] [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer
2011-10-13 17:28 [Bug fortran/50718] New: [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2011-10-13 22:25 ` burnus at gcc dot gnu.org
@ 2011-10-14 15:10 ` burnus at gcc dot gnu.org
2011-10-15 6:55 ` burnus at gcc dot gnu.org
2011-10-15 6:57 ` burnus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-14 15:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50718
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-14 15:09:25 UTC ---
Author: burnus
Date: Fri Oct 14 15:09:21 2011
New Revision: 179988
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179988
Log:
2011-10-14 Tobias Burnus <burnus@net-b.de>
PR fortran/50718
* trans-expr.c (gfc_conv_procedure_call): Fix -fcheck=pointer
for dummy arguments with VALUE attribute.
2011-10-14 Tobias Burnus <burnus@net-b.de>
PR fortran/50718
* gfortran.dg/pointer_check_11.f90: New.
* gfortran.dg/pointer_check_12.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/pointer_check_11.f90
trunk/gcc/testsuite/gfortran.dg/pointer_check_12.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50718] [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer
2011-10-13 17:28 [Bug fortran/50718] New: [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2011-10-14 15:10 ` burnus at gcc dot gnu.org
@ 2011-10-15 6:55 ` burnus at gcc dot gnu.org
2011-10-15 6:57 ` burnus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-15 6:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50718
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-15 06:55:35 UTC ---
Author: burnus
Date: Sat Oct 15 06:55:28 2011
New Revision: 180022
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180022
Log:
2011-10-15 Tobias Burnus <burnus@net-b.de>
PR fortran/50718
* trans-expr.c (gfc_conv_procedure_call): Fix -fcheck=pointer
for dummy arguments with VALUE attribute.
2011-10-15 Tobias Burnus <burnus@net-b.de>
PR fortran/50718
* gfortran.dg/pointer_check_11.f90: New.
* gfortran.dg/pointer_check_12.f90: New.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/pointer_check_11.f90
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/pointer_check_12.f90
Modified:
branches/gcc-4_6-branch/gcc/fortran/ChangeLog
branches/gcc-4_6-branch/gcc/fortran/trans-expr.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50718] [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer
2011-10-13 17:28 [Bug fortran/50718] New: [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2011-10-15 6:55 ` burnus at gcc dot gnu.org
@ 2011-10-15 6:57 ` burnus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-15 6:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50718
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-15 06:56:31 UTC ---
FIXED on the 4.7 trunk and 4.6 branch.
^ permalink raw reply [flat|nested] 7+ messages in thread