public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50718] New: [4.6/4.7 Regression] ICE (fold_convert) with -fcheck=pointer
@ 2011-10-13 17:28 burnus at gcc dot gnu.org
  2011-10-13 18:37 ` [Bug fortran/50718] " burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-13 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50718
           Summary: [4.6/4.7 Regression] ICE (fold_convert) with
                    -fcheck=pointer
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


FGSL version 0.9.3 from
http://www.lrz.de/services/software/mathematik/gsl/fortran/

With gfortran 4.7 and with gfortran 4.6.1 20110801 (rev. 177033), I get:

  api/siman.finc:99:0: internal compiler error: in fold_convert_loc,
                       at fold-const.c:2026

It works with 4.5.3 20110428 [rev. 173117].


#9  0x0000000000aeefab in build_array_type_1 (elt_type=0x2aaaaab48348,
    index_type=0x2aaaacf0d7e0, shared=true) at
/home/tob/projects/gcc-git/gcc/gcc/tree.c:7373
#10 0x0000000000604285 in gfc_get_character_type_len_for_eltype
(eltype=0x2aaaaab48348,
    len=<optimized out>) at
/home/tob/projects/gcc-git/gcc/gcc/fortran/trans-types.c:977
#11 0x00000000006089a9 in gfc_sym_type (sym=0x2ad5780)
    at /home/tob/projects/gcc-git/gcc/gcc/fortran/trans-types.c:2050
#12 0x00000000005c112c in create_function_arglist (sym=0x1bcb3d0)
    at /home/tob/projects/gcc-git/gcc/gcc/fortran/trans-decl.c:2067


^ 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 ` 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

end of thread, other threads:[~2011-10-15  6:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2011-10-15  6:55 ` burnus at gcc dot gnu.org
2011-10-15  6:57 ` burnus at gcc dot gnu.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).