public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds
@ 2011-12-07 10:50 francois.willot at cmm dot ensmp.fr
  2011-12-07 11:10 ` [Bug libfortran/51448] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: francois.willot at cmm dot ensmp.fr @ 2011-12-07 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51448
           Summary: Compiler crash when assigning floating point values of
                    different kinds
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: francois.willot@cmm.ensmp.fr


$ gfortran --version
GNU Fortran (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

$ cat 1.f90 
  PROGRAM MAIN
  IMPLICIT NONE
  TYPE mytype
    REAL b(2)
  END TYPE mytype
  TYPE(mytype) a
  DOUBLE PRECISION, ALLOCATABLE :: x(:)
  ALLOCATE(x(2))
  a%b=0.0E0
  x=a%b
  END

$ gfortran -O0 1.f90
1.f90: In function ‘MAIN__’:
1.f90:10:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

The program won't crash when "x=REAL(a%b, KIND(0.0D0))" instead of "x=a%b".

OS: Linux Mint 12, gfortran preinstalled package.


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

* [Bug libfortran/51448] [4.6/4.7 Regression] Compiler crash when assigning floating point values of different kinds
  2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
@ 2011-12-07 11:10 ` dominiq at lps dot ens.fr
  2011-12-07 12:41 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-12-07 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-07
            Summary|Compiler crash when         |[4.6/4.7 Regression]
                   |assigning floating point    |Compiler crash when
                   |values of different kinds   |assigning floating point
                   |                            |values of different kinds
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-12-07 11:10:31 UTC ---
r167173 is OK
r167380 gives a segmentation fault.

The backtrace for trunk revision 181881 (x86_64-apple-darwin10) gives

Program received signal SIGSEGV, Segmentation fault.
0x00000001000b6c0c in get_std_lbound (expr=0x141b15210, desc=0x142929d20,
dim=0, assumed_size=false) at ../../p_work/gcc/fortran/trans-array.c:7401
7401      if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)))
(gdb) bt
#0  0x00000001000b6c0c in get_std_lbound (expr=0x141b15210, desc=0x142929d20,
dim=0, assumed_size=false)
    at ../../p_work/gcc/fortran/trans-array.c:7401
#1  0x00000001000c005c in gfc_alloc_allocatable_for_assignment
(loop=0x7fff5fbfd450, expr1=0x141b15c30, expr2=0x141b16020)
    at ../../p_work/gcc/fortran/trans-array.c:7704
#2  0x00000001000d71a6 in gfc_trans_assignment_1 (expr1=0x141b15c30,
expr2=0x141b16020, init_flag=false, dealloc=true)
    at ../../p_work/gcc/fortran/trans-expr.c:6353
#3  0x00000001000b44b2 in trans_code (code=0x141b163e0, cond=0x0) at
../../p_work/gcc/fortran/trans.c:1209
#4  0x00000001000d141b in gfc_generate_function_code (ns=<value optimized out>)
at ../../p_work/gcc/fortran/trans-decl.c:5255
#5  0x0000000100072b7d in gfc_parse_file () at
../../p_work/gcc/fortran/parse.c:4410
#6  0x00000001000afd96 in gfc_be_parse_file () at
../../p_work/gcc/fortran/f95-lang.c:250
#7  0x0000000100692851 in toplev_main (argc=2, argv=0x7fff5fbfd9a8) at
../../p_work/gcc/toplev.c:557
#8  0x0000000100001674 in start ()


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

* [Bug libfortran/51448] [4.6/4.7 Regression] Compiler crash when assigning floating point values of different kinds
  2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
  2011-12-07 11:10 ` [Bug libfortran/51448] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
@ 2011-12-07 12:41 ` rguenth at gcc dot gnu.org
  2011-12-07 13:51 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-07 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.3


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

* [Bug libfortran/51448] [4.6/4.7 Regression] Compiler crash when assigning floating point values of different kinds
  2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
  2011-12-07 11:10 ` [Bug libfortran/51448] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
  2011-12-07 12:41 ` rguenth at gcc dot gnu.org
@ 2011-12-07 13:51 ` burnus at gcc dot gnu.org
  2011-12-07 17:46 ` [Bug fortran/51448] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-07 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-07 13:50:22 UTC ---
Workaround: -fno-realloc-lhs

Draft patch:

--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7428,7 +7584,16 @@ get_std_lbound (gfc_expr *expr, tree desc, int dim, bool
assumed_size)
                              gfc_array_index_type, cond,
                              lbound, gfc_index_one_node);
     }
-  else if (expr->expr_type == EXPR_VARIABLE)
+
+  if (expr->expr_type == EXPR_FUNCTION)
+    {
+      /* A conversion function, so use the argument.  */
+      gcc_assert (expr->value.function.isym
+                 && expr->value.function.isym->conversion);
+      expr = expr->value.function.actual->expr;
+    }
+
+  if (expr->expr_type == EXPR_VARIABLE)
     {
       tmp = TREE_TYPE (expr->symtree->n.sym->backend_decl);
       for (ref = expr->ref; ref; ref = ref->next)
@@ -7441,15 +7606,6 @@ get_std_lbound (gfc_expr *expr, tree desc, int dim, bool
assumed_size)
        }
       return GFC_TYPE_ARRAY_LBOUND(tmp, dim);
     }
-  else if (expr->expr_type == EXPR_FUNCTION)
-    {
-      /* A conversion function, so use the argument.  */
-      expr = expr->value.function.actual->expr;
-      if (expr->expr_type != EXPR_VARIABLE)
-       return gfc_index_one_node;
-      desc = TREE_TYPE (expr->symtree->n.sym->backend_decl);
-      return get_std_lbound (expr, desc, dim, assumed_size);
-    }

   return gfc_index_one_node;
 }


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

* [Bug fortran/51448] [4.6/4.7 Regression] Compiler crash when assigning floating point values of different kinds
  2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
                   ` (2 preceding siblings ...)
  2011-12-07 13:51 ` burnus at gcc dot gnu.org
@ 2011-12-07 17:46 ` jakub at gcc dot gnu.org
  2011-12-08 18:55 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-07 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |jakub at gcc dot gnu.org
          Component|libfortran                  |fortran


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

* [Bug fortran/51448] [4.6/4.7 Regression] Compiler crash when assigning floating point values of different kinds
  2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
                   ` (3 preceding siblings ...)
  2011-12-07 17:46 ` [Bug fortran/51448] " jakub at gcc dot gnu.org
@ 2011-12-08 18:55 ` burnus at gcc dot gnu.org
  2011-12-08 20:58 ` burnus at gcc dot gnu.org
  2011-12-08 21:54 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-08 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-08 18:51:33 UTC ---
Author: burnus
Date: Thu Dec  8 18:51:28 2011
New Revision: 182131

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182131
Log:
2011-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51448
        * fortran/trans-array.c (get_std_lbound): Fix handling of
        conversion functions.

2011-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51448
        * gfortran.dg/realloc_on_assign_8.f90: New.


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


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

* [Bug fortran/51448] [4.6/4.7 Regression] Compiler crash when assigning floating point values of different kinds
  2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
                   ` (4 preceding siblings ...)
  2011-12-08 18:55 ` burnus at gcc dot gnu.org
@ 2011-12-08 20:58 ` burnus at gcc dot gnu.org
  2011-12-08 21:54 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-08 20:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-08 20:55:09 UTC ---
Author: burnus
Date: Thu Dec  8 20:54:57 2011
New Revision: 182137

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182137
Log:
2011-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51448
        * fortran/trans-array.c (get_std_lbound): Fix handling of
        conversion functions.

2011-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51448
        * gfortran.dg/realloc_on_assign_8.f90: New.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/realloc_on_assign_8.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/trans-array.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/51448] [4.6/4.7 Regression] Compiler crash when assigning floating point values of different kinds
  2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
                   ` (5 preceding siblings ...)
  2011-12-08 20:58 ` burnus at gcc dot gnu.org
@ 2011-12-08 21:54 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-08 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-08 21:02:09 UTC ---
FIXED on the trunk (4.7) and on the 4.6 branch.

Thanks for the bug report!


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

end of thread, other threads:[~2011-12-08 21:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 10:50 [Bug libfortran/51448] New: Compiler crash when assigning floating point values of different kinds francois.willot at cmm dot ensmp.fr
2011-12-07 11:10 ` [Bug libfortran/51448] [4.6/4.7 Regression] " dominiq at lps dot ens.fr
2011-12-07 12:41 ` rguenth at gcc dot gnu.org
2011-12-07 13:51 ` burnus at gcc dot gnu.org
2011-12-07 17:46 ` [Bug fortran/51448] " jakub at gcc dot gnu.org
2011-12-08 18:55 ` burnus at gcc dot gnu.org
2011-12-08 20:58 ` burnus at gcc dot gnu.org
2011-12-08 21:54 ` 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).