public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/68153] New: ICE for intrinsic reshape with negative dim in effective shape
@ 2015-10-29 18:25 gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:26 ` [Bug fortran/68153] " gerhard.steinmetz.fortran@t-online.de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-29 18:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68153

            Bug ID: 68153
           Summary: ICE for intrinsic reshape with negative dim in
                    effective shape
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fortran@t-online.de
  Target Milestone: ---

This code with negative dimension(s) in shape sh :

$ cat z1.f90
program p
   integer, parameter :: sh(2) = [2, -2]
   integer, parameter :: a(2,2) = reshape([1, 2, 3, 4], sh)
   print *, a
end

$ gfortran -g -O0 -Wall -fcheck=all z1.f90
f951: internal compiler error: in gfc_simplify_reshape, at
fortran/simplify.c:5091

---

$ cat z4.f90
program p
   integer, parameter :: sh(2) = -2
   integer, parameter :: a(2,2) = reshape([1, 2, 3, 4], sh)
   print *, a
end

$ gfortran -g -O0 -Wall -fcheck=all z4.f90
f951: internal compiler error: in gfc_simplify_reshape, at
fortran/simplify.c:5091


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

* [Bug fortran/68153] ICE for intrinsic reshape with negative dim in effective shape
  2015-10-29 18:25 [Bug fortran/68153] New: ICE for intrinsic reshape with negative dim in effective shape gerhard.steinmetz.fortran@t-online.de
@ 2015-10-29 18:26 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-29 22:39 ` dominiq at lps dot ens.fr
  2015-10-30  6:26 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-29 18:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68153

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Detected, but pointing to the line before :

$ cat z3.f90
program p
   integer, parameter :: sh(2) = [2, 2]
   integer, parameter :: a(2,2) = reshape([1, 2, 3, 4], -sh)
   print *, a
end

$ gfortran -g -O0 -Wall -fcheck=all z3.f90
z3.f90:2:34:

    integer, parameter :: sh(2) = [2, 2]
                                  1
Error: 'shape' argument of 'reshape' intrinsic at (1) has negative element (-2)


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

* [Bug fortran/68153] ICE for intrinsic reshape with negative dim in effective shape
  2015-10-29 18:25 [Bug fortran/68153] New: ICE for intrinsic reshape with negative dim in effective shape gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:26 ` [Bug fortran/68153] " gerhard.steinmetz.fortran@t-online.de
@ 2015-10-29 22:39 ` dominiq at lps dot ens.fr
  2015-10-30  6:26 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29 22:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68153

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-29
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0). Note that the error emitted for the code
in comment 1 is quite misleading.


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

* [Bug fortran/68153] ICE for intrinsic reshape with negative dim in effective shape
  2015-10-29 18:25 [Bug fortran/68153] New: ICE for intrinsic reshape with negative dim in effective shape gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:26 ` [Bug fortran/68153] " gerhard.steinmetz.fortran@t-online.de
  2015-10-29 22:39 ` dominiq at lps dot ens.fr
@ 2015-10-30  6:26 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-30  6:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68153

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
This one is interesting.  gfc_check_reshape isn't checking
'sh' because it thinks 'sh' is a variable instead of a
named constant.  So, when gfc_simplify_reshape is called,
it runs into an gcc_assert that the element is greater
than zero because gfc_check_reshape should have emitted
an error.  If the gcc_assert is removed, an error message
is generated.


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

end of thread, other threads:[~2015-10-30  6:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-29 18:25 [Bug fortran/68153] New: ICE for intrinsic reshape with negative dim in effective shape gerhard.steinmetz.fortran@t-online.de
2015-10-29 18:26 ` [Bug fortran/68153] " gerhard.steinmetz.fortran@t-online.de
2015-10-29 22:39 ` dominiq at lps dot ens.fr
2015-10-30  6:26 ` kargl 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).